Restricting variable values and booleans

When you see a class diagram and one of the attributes is like the example below:
Status (Professional, Semi-pro, Amateur)
Is it possible to create this variable and restrict construction of objects using this variable to one of the 3 specified values. If so how is it done, been looking but can find no standard way to perform such a task.
Also when you use a variable that is a boolean, instead of printing out false or true in my toString () method, how can I make it more effective!!! It is always initially false indicating that no lessons have been received and if true indicates lessons have been taken. It would be far more useful to display 'Lessons Not Take' or 'Lessons Taken'. Again any suggestions are welcome!!!
Regards

Yes, you can do it with an enumeration.
Joshua Bloch shows how to do it in his "Effective Java":
http://java.sun.com/developer/Books/shiftintojava/page1.html
MOD

Similar Messages

  • Restrict variable values in the pop-up selection screen

    Hi,
    I have a variable based on a caracteristic that has 0COMP_CODE as attribute in a Web Report (BW 3.1B).
    This variable has to be accessible so that users can select a value.
    I need to restrict the values that users can see on the selection screen according to their 0COMP_CODE value, even in the pop-up.
    I have tryed authorization variable and user exit, but none worked.
    The best I could do was a "several single values" variable that was preselected with the caracteristics of their 0COMP_CODE, but it didn't worked in the pop-up.
    Does anybody knows how to handle this?

    As far as I could find out, it should be made through customer exit.
    The point is : I have to use a customer exit variable that has been check as "ready for input".
    I can't find a way to restrict the values displayed in the variable selection screen (in the help pop-up window for this variable).
    The exit can pre-fill the selection fields with values, but whenever the user opens the window, he sees all the values.
    I have tryed all the values for I_STEP (0,1,2 and 3) but none did it.
    Does anybody knows how to limit those values?

  • Restrict variable values based on another variable in the bex query...

    I am struggling to restrict the variable values from other varaible in the selection criteria. I have a variable which restricts he organisation(0ORGUNIT) and another to restrict employees.
    When the user selects any organisation unit form the hierarchy, I want only those employees related to that organsation in the varaible selection options.
    Is there any way I can make a variable values dependant on the another variable value in variable selection screen?
    Thanks,
    Your help in this matter will be much appreciated.
    Edited by: Kthapa on Nov 25, 2010 11:08 PM

    Hi Kthapa,
    Did u try using cmod?
    i_step = 1? Used to provide default values for the selection screen variables and
    i_step = 2 for filling up the variables after selection screen.
    Try using based on ur requirement.
    Hope this helps. Revert back for any queries.

  • Restricting Variable values selectively

    How to restrict values of Variable while creating query. For Ex: I am creating variable for Fiscal Year and it has a value starting from 2000 to 2050.
    So in my report it will show all the values, I would like to restrict it for say between 2002 and 2015.
    Thanks
    Raghu

    Hi Raghu,
    I hope u have already created a Variable for FISC Year,just check in the properties on the Variable ,in the details TAB,whether the TAB Variable Represents is Multiple Single values or Selection.
    If not Create one more variable with the above settings and in the Default values in the Propewrties TAB you can specify the range as 2005 to 2012.
    With this the report will run for the range u have given,incase if you want to change the value range then in the POP-UP screen ,change the values,say 2005 to 2015 and run the report.
    There are other ways too ,but hope this meets ur Requirement.
    Rgds
    SVU123

  • Changing Variable values and saving it across sessions.

    Hi,
    I've have an requirement like counting the number of times a form is opened and number of times a button is clicked.For this I tried to use global variables.I tried to increment the value of the variable each time a form is opened or a button is clicked.
    opencount.value += 1;
    But it didnt work for me.I tried to hardcode a value like
    opencount.value = 5;
    Even this is also not working.Do I need change any settings or extend rights.Is it possible to save the values that are persistent across the sessions.
    Please help

    I have another apporach using an extras object.
    What you is a script object 'Actions' with this script, to create a counter in the extras object in any form object.
    function initOpenCounter(targetObject) {
        if (targetObject.extras.nodes.namedItem("OpenCounter") === null) {
            targetObject.extras.nodes.append(xfa.form.createNode("extras", "OpenCounter"));
            targetObject.extras.OpenCounter.nodes.append(xfa.form.createNode("integer", "state"));
            while (targetObject.extras.OpenCounter.nodes.length > 0) {
                targetObject.extras.OpenCounter.nodes.remove(targetObject.extras.OpenCounter.nodes.item(t argetObject.extras.OpenCounter.nodes.length - 1));
            var newState = xfa.form.createNode("integer", "OpenCounter");
            newState.value = 0;
            targetObject.extras.OpenCounter.nodes.append(newState);
    Then you need another script, to call the function in the script object and raise the counter, when the form opens.
    I used a floating field in a text on a master pager and put this script into its initialize event.
    Actions.initOpenCounter(this);
    var cCount = parseInt(this.extras.OpenCounter.nodes.item(0).value, 10);
              cCount += 1;
    this.extras.OpenCounter.nodes.item(0).value = cCount;
    this.rawValue = cCount;
    Here's a sample form with an open and save counter.
    https://acrobat.com/#d=C90OHrJKx52LHrtbtahWzQ

  • Save variable value and locking the code

    Hi,
    I want to save some values of indicator on front panel in place of typing them each time. e.g,
    maximum velocity 1 mm/sec
    maximum accel .....
    Each time, while opening I want the values used in last experiment as default.
    I do not want to set a fixed default value, it should be from last experiment.
    Also, I have to lock the code so as no bady else can change it. But I do not know how.
    Any help is appreciated,
    Dushyant

    There is a VI method that will set all the values as default. However a VI can not call on itself, while it is running. So take a look at the attached code.
    The Main Project VI represents your code, and I added a password 123
    You would need to put that code at the very end of your code. Notice that I call the other VI and then finish. The other VI loads your VI, with password, and then sets the values to default once it stops running.
    Let me know if you have any questions.
    Attachments:
    Set Defaults.zip ‏20 KB

  • Sharing complex substitution variable values between ASO and BSO databases

    We have ASO and BSO Essbase database member names with spaces in, and need to store some of these member names in substitution variables. However, this has to be done differently for ASO and BSO, due to calc script syntax requiring double quotes and MDX requiring square brackets. For example:
    ASO:
    &CurWeek value = Week 1
    MDX: [&CurWeek]
    BSO:
    &CurWeek value = "Week 1"
    Calc Script: &CurWeek
    As a result, the substitution variables cannot be shared between the ASO and BSO cubes, since the BSO variable value requires double quotes due to the space in the member name.
    Is there a way to get the above to work with both ASO and BSO? Can the double quotes be escaped in calc script syntax? Or can the double quotes be removed in the MDX formula?

    Hi TimG,
    Apologies for such a late reponse to this, genuinely haven't had a spare second to reply until now!
    Yes, I suspect a complex alias name may be the best solution here, and to remove the spaces from the actual member names.
    I was not aware of the latter part at all. My colleague has confirmed as much on this too - DBAG 11.1.2.1 pp117 & 118:
    "Note: If a substitution variable value is numeric or a member name starting with a
    numeral or containing the special characters referred to above is to be used both
    in MDX and non-MDX situations, create two substitution variables, one without
    the value enclosed in quotation marks and one with the value in quotation marks."
    "To ensure that a new substitution variable value is available in formulas, partition definitions,
    and security filters, stop and restart the application. All other uses of substitution variables are
    dynamically resolved when used."
    This last paragraph is the most concerning since we were planning to be able to update substitution variables values and then access the new values from calc scripts and formulae instantaneously. This quirk is unexpected and a little inconvenient. We may have to look at scheduling a change of substitution variable value overnight, followed by a stop/start of the app ready for the next day, and to work around needing to access changed values instantly.

  • Changing restricted variables on the layout.......

    Hi All,
    I'm not sure if this is a bug or just the way BPS works, but here's the issue.
    We've created user-defined variable for 'Version', and in the definition we made it restricted by the user at the time of executing the layout.
    So when you first execute the layout, it does what it should and prompts you in a pop-up window to select a particular version from what the user is offered based on his user-defined values.
    The problem is, when you exit the layout and come back in, or even when you're in the existing layout you don't have the chance to bring up that pop-up window again to change your selection.
    If you click on the 'Other Combination' icon in the layout, the version appears, but it's protected and cannot be changed.
    Instead, you have to always go to the 'Set Variable' tool to change the the version you want to view.
    The 'Set variable' tool is not very user friendly, especially when you have a big list of variables to choose from, and it also forces the user to know various technical information to be able to select thr right variable for his needs.
    How can we get the variable pop-up to come up to change the variable vaalue, without having to go to 'Set Variable'?
    Thanks

    Hi Ehab,
    Unfortunately that is the way BPS works. It keeps the variable value in a buffer that basically consists of two tables upc_var_cha_sel and upc_var_cha_act. Check them out.
    I created a solution that automatically clears these tables of the variable value and gives the user a fresh popup box whenever they access the planning folder.
    The following is a thread I posted earlier with the sample code.
    Re: Change variable value for a user
    This code is part of an exit function in the planning scenario and can be executed by choosing the function attributes under Global Planning Functions in UPSPM and selecting either 'Function as Pushbuttton', 'Execute Function when Saving' or as I prefer, 'Execute Function when Starting field'.
    This works like a charm. Contact me if you need more details.
    Dennis (ATL)

  • Web report - Variable values while switching between views.

    Hi Gurus,
    We have a query which has a few variables that are getting populated with default values during query execution[customer exits].
    We have added this query to the web.Now there is a date variable  which gets populated with the current date value by default.Suppose the users don't vant to run the report for the current date, they are able to change the date in the variable window and execute. But once the report is run, and we try to choose a different vieew for the report, the report automatically gets refreshed with the selected view, but for the default current date value (because of the customer exit).Shouldn't the selected view be getting refreshed with the date values that the user had entered while executing the report?
    Also when navigating between the different views, shouldn't a variable window pop up? Is there any setting to have the variable window pop up when navigating between the different views of a web report?
    Would appreciate a quick response.
    Thanks a Lot
    Arvind

    hello,
    we need to go to Query properties -> interaction tab-> remove reuse variables to populate the variable screen everytime or "Save and reuse variable values" to supress variable window
    or
    Problem could be due to any personalisation.try this:
    One the query is executed, click on the button which says change variable values.
    In the variable pop-up screen which comes up click on the personalization button
    In the new screen which comes up click on reset personalization button
    Enter new variable values and execute the query.
    Reg,
    Dhanya

  • Variable value for IP Revaluation

    Hi Experts,
    I would like to run a revaluation function (with a button in workbook - IP). Variable is on the key-figure.
    The situation is strange:
    - click on the button with planning function call  - nothing happened
    - then when I click on change variable screen button (standard BEX function), system ask for variable value and execute the revaluation with entered %!
    What I'm doing wrong?
    How this could be marge together?
    What is the procedure to enter variable value in some cell in the WB?
    Thanks, Tom

    Hi,
    Just check the link below: how to pass variables to planning functions executed from BeX Analyzer.
    It also specifies how to enter variable value in some cell in the WB.
    I suggest you to use seperate variables for filter and seperate variable for Planning functions so as to avoid confusion.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0881371-78a1-2910-f0b8-af3e184929be
    Best Rgds
    Shyam

  • Display Variable Values in 7.0

    There was an option in BW 3.x to display variable values using technical settings -> display -> variable values.  I do not see this option in 7.0!?  Showing the variable values is a great way to figure out whether or not a customer exit variables are working as expected.  Could someone please help me with finding this option in the BEx analyzer?  Points will be assigned for useful posts?  Thanks for your time.

    Dear Sameer,
    As I understand from your question that you want to debug whether the customer exit variable logic is workinig fine or not. For that you can set a session breakpoint for the variable exit in CMOD. Now use the transaction rsrt to run the query. This will take you to the debug mode and here you can see the variable values and whether the logic is performing as expected or not.
    Regards,
    Prem.

  • Problem in picking the system variable value in Calculation Script

    Hi All,
    We are using a Calculation Script to perform data export. And the target location where to crete the exported output file is given to the environment system variable.
    Now I am using this system variable in the calculation script as below:
    //ESS_LOCALE English_UnitedStates.Latin1@Binary
    SET DATAEXPORTOPTIONS
    DataExportLevel "ALL";
    DataExportOverwriteFile ON;
    Fix ( &CurrMiles, &CurrProj, &CurrVer,"No Project","No Version")
    DATAEXPORT "File" " " $DEXPORTPATH;
    ENDFIX
    Here "DEXPORTPATH" is the system variable
    I am creating this system variable from the batch script and the system variable value varies at the runtime.
    This calculation script works fine for first time and it picks the correct value from the system variable.
    But the problem occurs from next execution of calc script. Even if i update the system variable with other value, it picks only the last execution system variable value and it performs execution.
    Eg: Suppose for first execution system variable value is "D:\Bkup\PMV.txt"
    The calc script works fine with this.
    For next execution, system variable value is changed to "D:\Time\temp.txt"
    Now the calc script picks the system variable value as "D:\Bkup\PMV.txt"
    and performs execution which is wrong.
    Please help me on this issue how to handle system variables in calc scripts.
    Thanks in advance
    Regards
    Swathi

    811829 wrote:
    Hi All,
    We are using a Calculation Script to perform data export. And the target location where to crete the exported output file is given to the environment system variable.
    Now I am using this system variable in the calculation script as below:
    //ESS_LOCALE English_UnitedStates.Latin1@Binary
    SET DATAEXPORTOPTIONS
    DataExportLevel "ALL";
    DataExportOverwriteFile ON;
    Fix ( &CurrMiles, &CurrProj, &CurrVer,"No Project","No Version")
    DATAEXPORT "File" " " $DEXPORTPATH;
    ENDFIX
    Here "DEXPORTPATH" is the system variable
    I am creating this system variable from the batch script and the system variable value varies at the runtime.
    This calculation script works fine for first time and it picks the correct value from the system variable.
    But the problem occurs from next execution of calc script. Even if i update the system variable with other value, it picks only the last execution system variable value and it performs execution.
    Eg: Suppose for first execution system variable value is "D:\Bkup\PMV.txt"
    The calc script works fine with this.
    For next execution, system variable value is changed to "D:\Time\temp.txt"
    Now the calc script picks the system variable value as "D:\Bkup\PMV.txt"
    and performs execution which is wrong.
    Please help me on this issue how to handle system variables in calc scripts.
    Thanks in advance
    Regards
    SwathiAs of my knowledge system variables will not update immediately...you need to log off the session after changing the value.
    Update the system variable..
    Log off from the session..
    And Re-login with the same username ....and check...
    Regards,
    Prabhas

  • How to create an array containing shared variable values

    Hi
    I am trying to programmatically create an array containing shared variable values and their names.  I can get the variable names by supplying the process name to the get shared variable list function.  How do I then read the value of all the shared variable items returned?
    I have used a data socket open to open a connection to all variables when my program starts.  I then use datasocket read on the opened connections to write to an array.  This works fine until I try to write to one of the variables using a shared variable node.  The variables writes can take from 4secs to 2 mins.  When I remove the shared variable node again all is fine.  Also when I stop using the data sockets, all is fine.
    Is there a conflict between shared variable nodes and data socket writes to the shared variables?
    Can anyone help?  I cannot easily post example code because I am reading the variables from a Wago PFC (PLC) using OPC.

    Hi
    Sorry I forgot to mention the LabVIEW version, its 8.20.  I have tried saving the shared variable node as a sub VI and it makes no difference.
    Attached is a stripped down version of the software.  You will not be able to connect to the IO server because it requires some Wago hardware and software.  You may spot something I have done wrong with the I/O servers, variables or sub VI's.
    The main program that runs is called 'HMI Engine' in the 'Framework' folder.  There may be some other things in the project that aren't used in this example.  I have removed all but the variable connection part of the code.
    I hope someone can help!?
    Thanks
    Mark.
    Attachments:
    HMI Test.zip ‏144 KB

  • How to get variables queryID and Result Area in AO  same as SAPBEXonRefresh(queryID As String, ResultArea As Range)

    Hi Folks,
    I am migrating some BEX 3.5 workbooks that contain macros into BusinessObjects Analysis workbooks.
    VBA knowledge is rare but I figured out how to call routines after refresh using
    Application.Run("SAPExecuteCommand", "RegisterCallback", "AfterRedisplay", "Callback_AfterRedisplay")
    Now I attempt to copy the SAPBEXonRefresh code into the Sub Callback_AfterRedisplay() but SAP SAPBEXonRefresh
    used queryID and ResultArea as parameters.
    As far as I see these are global SAP variables available in BEX but not available in AO.
    What are the equivalent functions in AO to get those values so that I can use the functions to fill the variable values and the "old" code can run?
    Thanks for all replies in advance,
    Axel

    Hello Axel,
    i am not familiar with the SAPBEXonRefresh sub. From the Parameters i infer that it probably gets called once for every queryID and ResultArea.
    If you register a "Callback_afterRedisplay" macro in Analysis, it does not get called once for every datasource. It gets called only once after a redisplay, regardless of the number of datasources and crosstabs in your workbook.
    Analysis Workbooks have named ranges for the Analysis crosstabs. You should be able to use these for the ResultArea. The named range has a "SAP" put in front of the crosstabs formula alias.
    e. g. in the Analysis Design Panel components tab your crosstab is listed with the formula alias "Crosstab1" the named range would be: "SAPCrosstab1".
    If your own VBA code needs a ResultArea and QueryID Parameter, determine and assign the appropriate values before executing.
    e. g. your workbook has one datasource "DS_1" and one crosstab with formula alias "Crosstab1":
    Sub Callback_AfterRedisplay()
    Dim ResultArea as Excel.Range
    Dim queryID as String
    set ResultArea = ActiveWorkbook.Names("SAPCrosstab1").RefersToRange
    'probably set ResultArea = Range("SAPCrosstab1") might work as well
    queryID = "DS_1" 'or something appropriate to your old code
    Call SAPBEXonRefresh(queryID, ResultArea)
    End Sub
    Sub SAPBEXonRefresh(queryID as String, ResultArea as Range)
    <YourOldCode>
    End Sub
    Adapt the coding in "Callback_AfterRedisplay" to execute the "SAPBEXonRefresh" sub more than once for additional crosstabs and queries.
    Regards,
    Werner

  • Variable value not showing in sql developer  tool

    HI,
    I am using sql developer tool. when i take mouse in variable name at debugging its not showing variable value and instead showing variable name data type and owner. but in past i have used sql developer tool where when i take mouse on variable at debugging mode it shows the varable value.  please tell me is there any issue in sql develper tool currently i am using.
    sql developer version 2.1.0.63

    Sorry - but I doubt if you will get much help for that ANCIENT version of Sql Developer.
    My best suggestion is to download the current version and see if you still have the problem. There have been HUNDREDS of bug fixes since that version you are using.
    Oracle SQL Developer Downloads
    Take note that the current version REQUIRES a much higher JDK version than what you may be using. And do NOT try to install the new version on top of the old one.
    Install the new version into a totally new folder. You will be ask if you want to import your settings from your current version.

Maybe you are looking for

  • Help!  Can I still install Windows Vista through Bootcamp?

    I am currently running Lion 10.7.3 on my MacBook Pro.  When I purchased this laptop 2 years ago, Bootcamp allowed me to create a partition and install Windows Vista.   Then, over time I upgraded to OS X Snow Leopard and then Lion.  Never really paid

  • Red images in bridge and cs5?

    In the last couple of months my images have become quite red in bridge and it switches back and forth from being too red on photoshop and then too red on bridge.  I have no idea what the problem is and need help please.

  • Internet Explorer 9 doesn't display XML Report Text

    I have just updated reasently to Internet Explorer 9 and now all of my XML Reports do not show the report text.  I've attached a pic where you can plainly see the report test in TestStand but not in IE9. The other intresting thing is if the XML is on

  • Distribution cycle problem

    Hi, I created Distribution cycle dated on 27.06.2010 through KSV1. During execution through KSV5 put period 1 to 3, fiscal year 2010, cycle name and start date ie. creation date of distribution i.e, 27.06.2010, tick on test run and details list. Duri

  • How do i get rid of plug- in 2 for NPAPI Browsers

    The Java plugin- 2 NPAPI browser is really taking up alot of space on my computer,and i dont even use it.how can i get rid of it.all doent seem to know so this is my last resort.