How to give different value to a static variable???

Hi all:
Is there any solution to set different values to a static variable???I had try two ways but all have errors!
1.Way_1
protected String tmp=null;
protected void initSituation(int sayorpress)
if (sayorpress==0)
tmp = "string1";
else if (sayorpress==1)
tmp = "string2";
protected static String RESOURCE_STRING = tmp; <---error
Error:non-static variable tmp cannot be referenced from a static context
2.Way_2
protected void initSituation(int sayorpress)
if (sayorpress==0)
protected static String RESOURCE_STRING = "string1"; <---error
else if (sayorpress==1)
protected static String RESOURCE_STRING = "string2"; <---error
Error:illegal start of expression at
not an expression statement at
Thank you very mich!!!

Try this:
protected static String RESOURCE_STRING = null;
protected void initSituation(int sayorpress)
if (sayorpress==0)
yourClass.RESOURCE_STRING = "string1";
else if (sayorpress==1)
yourClass.RESOURCE_STRING = "string2";
You cannot declare a static variable inside a method. But you can access a static variable thorugh your class.

Similar Messages

  • Urgent!!! How to give a value to a BEx variable in the planning fuction?

    Hi all,
    does anybody know how can set variable's value in the palnning fuction (type exit) in IP?
    The two function modules in BPS which make this job don't work in the IP.
    thanks very much for any proposal.
    hongwei

    Hi,
    Reg the first part of the question, can you please explain how do you want to capture the variable for the custom planning function? Because, when I look at standard functions delivered by SAP, in the FROM CHANGE and TO CHANGE(for example copy function), we can select the BI variables or create new variables also.
    To pass the values to this variable from BEx Analyzer, we need to use the command range in BEx Analyzer and capture the values.
    I have used this approach to capture the BEx variable values into a FOX function using VARV function, but Im not pretty sure how to pass it to a custom planning function.
    Regarding the second part of the question can you pls look at FM :   RSPLSSE_PLSEQ_EXECUTE. I think you need to embedd your planning function into a sequence and call it with the above FM.
    You can also have a look at the ABAP program that is used to trigger a planning sequence by placing a breakpoint in any of the planning functions : "RSPLS_PLSEQ_EXECUTE" wherein you can pass the sequence name in the variant.
    Rgds
    Shyam

  • Different measures use same source column but gives different values in SSAS project

    I've inherited a SSAS project. I'm currentlig gaining knowledge, but do not understand this: There are 4 measures that get data from same source table and column. Example measures:
    [Started]
    [Processing]
    [Processed]
    [Finished]
    All of them gets data from a table (view), and a column "Event_count" with just value 0 in each row. Usage of the measure is "Count of non-empty values".
    Correctly all of these measures gives different values, but I don't understand how since they all go against the same source column. I thougt maybe they were defined in Calculated measures, but nothing there. Where or what else could be affecting this behavior?
    Bonus information (problem): One of the measures is returning blank/empty, which is why started with this research at all.
    Help anyone?
    regards .r

    Hi ,
    I would ask if all the measures are under the same measure group ? It is important to know, since in the dimension usage we are creating relationships between dimensions and measure
    groups .
    Did you try the delete all the calculation's code and leave only the " CALCULATE ; " part ? Do the values change after deploying the slim script ?
    Are all properties the same ? defaults & caching ?
    Regards, David .

  • How to Open URL value stored in a variable in JSP

    Hi all,
    I want to know how i can use value of a string variable in a JSP as url to open.
    <% String abc="some url value" ; %>
    then i want to open abc as URL in JSP
    Please suggest something on this.
    any help in advance will be highly appreciated.
    thanks,
    savdeep.

    thanks rahul but,
    I want to open the URL in
    <% String URLvariable="abc.htm" ; %>
    <% out.println("< a href=URLvariable>"+rs.getString("Some JSP value")+"</a>"); %>
    please suggest how should i open the above URL value stored in JSP variable.
    any help will be highly appreciated.
    thanks,
    savdeep.

  • How do I pass value to 'getURL' url variable

    Howdy,
    I`m trying to launch a popup from a flash form using MX 7
    The popup works fine but I cant for the life of me work out how to pass 'theid' value to the url variable for the popup window.
    I think somthing like this can be done with action script and maybe a cfc but I really dont know how.
    You will notice I referenced 'theid' value directly, I know this will never work but just wanted to show what i was trying to acheive. If I were using a HTML form I could use some javascrip to get the element by id and append the value to the url. Is there away to do this in action script?
    <cfform format = "flash">
    <cfsavecontent variable="ticketpopup">
        getURL("javascript:window.open('supportdetails.cfm?id=#theid#' , 'TicketDetails', 'width=900,height=630, Scrollbars=1, resizable=0'); void(0);");  </cfsavecontent>
    <cfselect name="selectbox" query="thequery" value="id" display="whatever"></select>
    <cfinput type="hidden" name="theid" bind="{selectbox.selectItem.data}">
    <cfinput type="button" name="mybutton" value="whatever" onClick="#ticketpopup#>
    </cfform>
    Any help, much appreciated :-)
    Thanks

    I answered my own question, heres is a solution if anyone is interested..
    You can add the following actionscript to the onChange attribute of the select box. Its passes the value of the selected index to the URL and opens in a new window :-)
    No there is no need for a hidden field or a button either
    <cfform format ="flash">
    <cfselect name="name" query="thequery" value="thevalue" display="whatever">
    onChange="getUrl('supportdetails.cfm?ticketnumber=' + categorysubject.dataProvider[categorysubject.selectedIndex]['data'],'_blank');
    </cfselect>
    </cfform>

  • How to give two values of same field in read Statment

    Hi,
    Please Tell me how to give the two values of same field in read statements Condition.
    i.e
      Read table it_tab with key matnr = '1' or matnr = '2'.
    With Regards
    Kesavaperumal

    Hi Kesavaperumal,
    <li>You can not use OR operator with READ TABLE statement.
    <li>You have to use different fields of the internal table in where condition.
    <li>If you want to compare with two values, you need to use LOOP statement.
    LOOP AT it_mara WHERE matnr = '1' or matnr = '2'.
    "Write code
    ENDLOOP.
    Thanks
    Venkat.O

  • How to get different values in drop down in  table rows

    Hi
    I have an application, which has a drop down in the table. Each row is to have different values in its drop down based on the "characteristic" parameter. For eg. first row has characteristic as color, and the corresponding drop down will contain the color names. Second row has charateristic as weight, and the drop down will carry corresponding weight values.
    I am getting the data from the backend as a flat table i.e. charaterisitc - value pair.
    I think i will have to use the Drop Down by Index control, but i dont know how exactly to go about it.
    Can any one please help in this regard.
    Thanks & regards,
    Anupreet

    Hi Maksim
    I am sorry, but i am not able to get you.
    This is the piece of code that i wrote for populating the drop down:
    IPrivateMaintainDocAttribView.IDropElement dropEle = null;
    for(int i = 0;i<size;i++)
                 dropEle = wdContext.nodeDrop().createDropElement();
                 dropEle.setDropval(wdContext.nodeCtxNode_DocAttribs().getCtxNode_DocAttribsElementAt(i).getCmpCtx_Value());
                 wdContext.nodeDrop().addElement(dropEle);
    Here, Dropis the sub node to which i am putting the data and thisis linked to the table.
    CtxNode_DocAttribs is the model node from where i am picking the data and setting in the subnode.
    Thanks & regards,
    Anupreet

  • How to input different values without logging out everytime in OATS

    Hi,
    I am new to OATS. I was trying the functional testing of a web application. For this I recorded it by first logged in the application then input some values in a field, submit it and logout.Then i tried to iterate it with different values in the input field, but the problem was that for every iteration it was logging in every time. How can i stop logging in everytime and put the values all in one login. Also can anyone provide me online tutorial for OpenScript used in OATS.
    Edited by: user13268396 on Jul 6, 2011 3:36 AM

    Hi,
    If you go to
    http://www.oracle.com/technetwork/oem/downloads/index-084446.html
    There is a section for Documentation download. Within this there is the OpenScriptUserGuide.pdf, with full explanations of the technology.
    For the iteration with out logging again you have to insert "for" loop.
    Regards,
    Srinivas

  • How to give level value 'unknown'

    Hi there,
    When creating a dimension with OWB, we get for every level also a row with empty values voor de levels underneath.
    E.g.: Dimension customer: Level Total, level customer group, level customer.
    I get:
    =====================================
    Level_total customer_group customer
    Total NULL NULL
    Total Group1 NULL
    Total Group2 NULL
    =====================================
    This is generated by OWB automatically.
    Anybody any idea how to fill in 'Unknown' instead having it blank? I've looked if i can fill somewhere a property, but could not find.
    Any help is appreciated.
    Thanks
    Sandra

    hii vishal,
    this selct option i already taking from database.
    only i want to give constant value to this field ..
    u mean to write selection-screen  select-option in coding part of query/infoset?
    for this field?
    n give const value in this code/.?

  • Can we give where condition while db polling, if yes how to give the value

    Hi,
    We are polling a db table, can we give where condition in polling query. If we can give this then where to pass the value for the condition.
    eg:
    select * from xxtable wherexxname=#xxname;
    If above is the db polling query then how to pass #xxname value to db adapter.
    After polling we are deleting the row in the table.
    Thanks,
    Ra

    You can add where condition , but the value should be passed while configuring DB Adapter itself. You can't pass dynamic values to it as it is polling and gets activated once the process is deployed.
    Thanks,
    Satish
    http://soadiscovery.blogspot.com

  • How to load value to a static variable on the run

    hi all
    i have a question about static variable. i need to have a variable to keep a value from DB shared by all instances. the variable is given value when the first instance is created. but from time to time, the value in DB may change, but i still need to maintain this shared value among instances. the static variable has life time as long as the program runs, does that mean if i need to change the value, i need to stop the program, and restart to load the new value? thanks.

    can the static variable be accessed within a
    non-static method, for instance, set the value by
    setXXX() method?Yes, and oddly enough, that usually how I access all my variables...
    Example...
    public class StaticTester {
           static String theString = " My Message ";
           public void setMessage(String mess){
                      theString = mess;
           public String getMessage(){
                      return theString;
           public static void main(String[] theArgs){
                      StaticTester myTest = new StaticTester();
                    System.out.println(myTest.getMessage());
                    myTest.setMessage(" a New Message ");
                 System.out.println(myTest.getMessage());
    }Hope this helps...
    - MaxxDmg...
    - ' He who never sleeps... '

  • How to assign bean value to a local variable in JSP using struts.

    Hi everybody!
    I've a problem that puzzled me on how to assign a bean value to a local variable like String in JSP using struts.
    we can have someting like this to display the value
    <bean:write name="detailService" property="status" />or
    <bean:define id="theStatus" name="detailService" property="status"/>
         This is country: <%=theStatus%>but an error occured when I tried like this:
    String currentStatus = "<bean:define id="theStatus" name="detailService" property="status"/>";
    or
    String currentStatus = "<bean:write name="detailService" property="status" />";Is there a way to do this?.....
    Any help pretty much appreciated

    Java != JSP.
    The <bean:define> and <bean:write> tags are custom tags meant to appear in the HTML section of a JSP file, as opposed to the scriptlet section. They actually get turned into java code as part of the translation process.
    The <bean:write> tag naturally just writes out what you tell it to.
    The <bean:define> tag defines a local variable, and gives it a value.
    this should do it.
    <bean:define id="theStatus" name="detailService" property="status" type="java.lang.String"/>
    <%
      String currentStatus = theStatus;
    %>With the advent of JSTL, you shouldn't really need to use scriptlet code anymore. Personally I am for 0% scriptlet code in any jsp I write.

  • How to pass a value to a bind variable in a query report in oracle apex

    Hi Guys,
    I have requirement to send weekly reports via email to some users. The users should receive their own records in the report. The user details is stored in a table. What I am planning to do is to create a report query in oracle apex to generate the report and then run a function/procedure via a scheduler to email the report to respective users. Now my query is ............. is it possible to pass a value (user name) to the report query to pull records of only that user? I know we can have bind variables in the report query but I have no idea how to pass a value for bind variables from a function/procedure.
    Can anyone help me on this issue or suggest a better approach?
    Thanks,
    San

    You need to use dynamic sql
    But please keep in mind that since you're using Oracle you may be better off posting this in some Oracle forums
    This forum is specifically for SQL Server
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How to set a value to a Presentation Variable using GO URL?

    Hi All,
         I am working on a drill (GO URL) from Dashboard page1 to Dashboard page2.
         The problem I am facing is, I am not able to pass a value to the presentation variable through GO URL. (I have to pass "Customer Category" static
    value to The presentation variable present in Dashboard Page2 ).
         The Dashboard page2 is having a view select in which we are using presentation variable to select the report based on the value selected in
    View Select.
         For example: If the user selects "Customer Category" value in View select and clicks on GO button Customer Category report will show the out put.
         When i am drilling from Dashboard Page1 I have to pass a value to the presentation variable used in view select and also pass some filter condition in
         GO URL.
         Please let me know if it is feasible to pass a value to the presentation variable through GO URL in OBIEE 10.1.3.4.
         It will be greate if you can provide me with the syntax to set a value to the presentation variable of dashboard page2 through GO URL.
    Thanks and Regards,
    Sagar Vishwanathwar.

    1) You have to navigate to dashboard page, not to answer request = you have to use "Dashboard URL API" not GO URL API.
    2) On the target page, you have to place dashboard prompt, which sets required presentation variable.
    3) Refer to the target using Dashboard URL API and set filter on prompt column using URL parameters. Example: http://localhost:9704/analytics/saw.dll?Dashboard&PortalPath=%2Fusers%2Fadministrator%2F_portal&Page=page%201&Action=Navigate&P0=1&P1=eq&P2=D_TIME.YEAR_CODE&P3=%221996%22
    Do not forget to use Action=Navigate. The syntax for setting filters using url parameter is the same as for GO URL API described in Business Intelligence Presentation Services Administration Guide.
    This is the way, you can implement navigation to parametrized direct SQL reports including passing filter values...
    Regards K.

  • How to overwrite the value of a struts variable value using struts only

    Say i define a variable using struts in my jsp
    <bean:define id="aVar" value="abc" />
    Now the variable has a value of abc , how can i overwrite it again to have another value --say "123"..
    I need to change its value using struts only and not scriplet.
    Kindly help ....

    This page may be helpful:
    http://www.exampledepot.com/egs/javax.servlet.jsp/usebean.jsp.html

Maybe you are looking for

  • Why i can't get latest firmware update for n97?

    I can see there is new update for n97 (21.2.045) but update check from phone and pc says i have the latest version. i don;t have latest version. i have september firmware on.

  • Making a list of all events in one calendar?

    Is there any way to ask iCal to generate a list of all events and ToDo's from a given calendar? iSync doesn't really support multiple calendars when syncing to Palm OS devices: all events created on the Palm are put into one specified calendar (in my

  • Mac air won't connect or back up to time machine

    I recently purchased a 3TB Airport Time Capsule.  My Mac Pro happily backs up, but the Mac Air is now refusing to do so using the same set up.  The error message I am getting is: There was a problem connecting to the server "Andrew's AirPort Time Cap

  • OS User SID ADM  profile not loading in Windows 2008

    Hi Experts , We have installed Netweaver 7.o EHp1 BI 7.01 on windows 2008, MS SQL 2008 . After few days, we are not able to login with the SIDADM user. The error getting is "User profile cannot be loaded" 'The LoadUserProfile call failed with the fol

  • Has anyone else recently dealt inept Adobe Tech Support?

    This an email I sent to this woman's supervisor: I'm writing to let you know that your tech support person, Anumeha, solved my problem. She was the only one that could! She is an asset to your company. Give her a raise in pay. Take her to lunch. Do s