Local variable default value

Hi
Just a quick question to get me out of a hole..... I am using local variable to control while loops, and based on a counter value, it turns it on or off. When i probe the value of the actual boolean, it comes up not exectuted, but the local indicator value is true???? is there any way to change this?? i need to to remain false, UNTIL it goes true!
Cheers
Peter
Solved!
Go to Solution.

I think that "Ravens" has hit the nail on the head. Using unprotected shared resources (like local variables) in parallel will open the door to race conditions... the bane of any programmers life!
Here are some useful resources which further explain this concept.
Using a Local, Global, or Shared Variable in Parallel Loops Can Cause Race Conditions
http://digital.ni.com/public.nsf/allkb/4F3CC921B4179F9F86256A3B0045CE2D
Tutorial: Local Variable, Global Variable, and Race Conditions
http://zone.ni.com/devzone/cda/tut/p/id/7585
The first link also mentions the producer/consumer articeture and the semaphore. Both great solutions. However, correctly sequencing your source code (using things like error clusters) will help prevent this issue.
Further more, I wonder if you are initialising your variables??
You should write a value of false to the variable before you enter the main body of your code. This ensure that the first time you read from the variable it will return a known value (false). If you dont do this, the variable will return what ever was the last value written to it.
Hope this has been useful.
Rich R
Applications Engineer
National Instruments UK & Ireland

Similar Messages

  • BW Query variable default value put in Crystal report variable question

    Why BW Query variable default value put in Crystal report variable for BO InfoView to open crystal report.
    I using Analyzer to open bw query,variables had default value ,but crystal report can't had variable default value ,and can't search variable  value.
    pho:
    [http://file.itpub.net/f/e38876ad4f6efb7e73980488e7d71f8d/4ae940e9/day_091029/20091029_2b04da1232144feba180OrB23SNvXtoT.gif/p/1.gif]
    [http://file.itpub.net/f/d93ddfe61e0eaf80429726c61f1a02ff/4ae940e9/day_091029/20091029_3211ffe04bf0302fbab5FRKnbwmH80p7.gif/p/BW_QUERY_Crystal.gif]
    Edited by: flying on Oct 29, 2009 8:20 AM

    I Know what to do .
    but Crystal report date variable value are Garbage characters "###".
    PHO:
    [http://file.itpub.net/f/39a8510104476707ae21c945db93ecba/4ae97949/day_091029/20091029_32dcbb7e7d99141483aesJ9KBJHXN0Kj.gif/p/2.gif]

  • How to set variable default value by program?

    Dear all,
    We would like to set a BW variable default value by program (not using query designer).
    Do you have any ABAP sample code for this? I'm really new in ABAP programming.
    we are using BI 7.0
    Thank you for your help!
    Olivier DESFOUR

    Hi Olivier,
    FOllowing is the code which defaults calmonth to first month of the year to current month - 1.
    Data : input1(4) TYPE n,
           input3(2) TYPE n.
    WHEN 'YQV_FD'.
      if i_step = 1.
      input1 = sy-datum+0(4).
      concatenate input1 '01' into l_s_range-low.
      input3 = sy-datum+4(2) - 1.
      concatenate input1 input3 into l_s_range-high.
      l_s_range-sign = 'I'.
      l_s_range-opt = 'BT'.
      APPEND l_s_range TO e_t_range.
      endif.

  • BEx Variable default value does not pass thru to Webi report

    Hi,
    It appears that the integration between BEx and BOBJ Webi does not support default values when the webi report is scheduled.  This means that if Webi/Infoview is the delivery method, than clients require 2 reports.  1 for adhoc and 1 for scheduling.  Is there another way around this so 2 reports are not required?  See SAP Knowledge Base Article  https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/sno/ui_entry/entry.htm?param=69765F6D6F64653D3030312669765F7361706E6F7465735F6E756D6265723D3030303136363534393826
    Regards,
    Dae Jin

    Hi,
    Yes it is not supported. you can achieve by writing customer exit for this.
    in istep 2,
    check whether the variable value is intial.
    if intial
    pass default value
    if not intial (else)
    dont do any change, just pass the user input to restriction.
    -Sriram

  • Variable default values

    Hi Experts,
    I am using a variable for Date From to Date to in my Query.  I had used the variable 0I_SPL_D which supplies two date Period from / Period To. My requirement is to give default values at run time from beginning of the month to current date of execution.
    So that I can schedule the Query and Broadcast it.
    eg If the report is run today ie on 22.0ct.2009 then both the ends must have the values
    from date 01.10.2009 and
    to date     22.10.2009
    If the report is executed tomorrow the parameters should be
    from date 01.10.2009 and
    to date     23.10.2009
    can any one give any idea
    Thanks
    Shivani

    Hi,
    Try this code.
    WHEN 'Zvariable'
    DATA: from_dy(2) type n,
               from_mo(2) type n,
               from_yr(4) type n,
               from_d(8) type n,
               Date_to TYPE sy-datum.
        IF i_step = 1.
          from_dy(2) ='01'.
          from_mo = sy-datum+4(2).
          from_yr = sy-datum+0(4).
          concatenate from_yr from_mo from_dy into from_d.
          Date_to = sy-datum.
          CLEAR l_s_range.
          MOVE from_d TO l_s_range-low.
          MOVE Date_to TO l_s_range-high.
          MOVE 'I' TO l_s_range-sign.
          MOVE 'BT' TO l_s_range-opt.
          APPEND l_s_range TO e_t_range.
        ENDIF.
    Regards,
    Rk.

  • Global variable default value

    Hi All.
    I am running Test Stand 3.5 scripting Labview 7.1 vi's to test batches of populated PCB's (using single pass method). On each initial run of aTest Stand session the test site cables need to be calibrated and the values stored for later use. i.e calibrate the site just the once per session.
    I have tried using both a boolean station global and boolean sequence file global and setting them to 'True' when calibration is finished. However the sequence file global defaults to 'False' at the end of each run, (hence cuasing a calibrate each run). and the station global stays 'True' even after the session is ended and Test Stand is closed down. ( hence next session calibration routine is ignored).
    Is there a way to either  a) stop the sequence file global defaulting to 'False' after each 'single pass' run yet default to 'False' on Test Stand shutdown. Or b) default the station global to 'False' on Test Stand shutdown? either method would be OK.
    Any help would be appreciated.
    Thanks
    Ian R

    Thanks anyway but I just found I need to set the sequence file global properties to 'Shared at run time'.
    Cheers

  • Default initialisation of member variables and local variables

    I don't understand why member variables are initialized with default values by Java.
    Objects are initialized with "null" and primitives with "0", except boolean, which is initialized with "false".
    If these variables are used locally they are not initialized. The compiler requires them to be initialized by the programer, for example "String s = null".
    Why? What is the use of that difference?
    And why are arrays always initialized with default values, no matter if they are member variables or local variables? For example String[] s = new String[10]; s[0] to s[9] are initialized with "null", no matter if "s" is a local or member variable.
    Can someone please explain that strange difference, why it is used? To me it has no sense.

    Most of the time I have to initialize a local variable
    with "String s = null" in order to use it because
    otherwise the compile would complain. This is a cheap
    little trick, but I think everyone uses it.
    I wouldn't agree with "most of the time". The only cases where it is almost necessary to do that is when the variable should be initialized in a loop or a try-catch statement, and that doesn't happen too often.
    If local variables were initiliazed automatically without a warning it would be a Bad Thing: the compiler could tell when there is a possibility that a variable hasn't been assigned to and prevent manymanymany NullPointerExceptions on run time.
    And you didn't answer me why this principle is not
    used with arrays if it is so useful as you think.
    Possibly it is much more difficult to analyse the situation in the case of arrays; what if values are assigned to the elements in an order that depends on run time properties such as values returned from a random number generator.
    The more special rules one has to remember, the more
    likely one makes errors.I agree, but what is the rule to remember in this case?

  • Error in assigning value to local variable

    i am writing a stored procedure in which i have pass parameter if parameter value is zero then i assign a previously declared variable null else that value
    syntax is this
    create or replace
    PROCEDURE usp_Add_Update_Insurance
    p_CityID IN NUMBER DEFAULT NULL
    as
    v_CityID number(10,0);
    begin
    IF p_CityID = 0 THEN
    BEGIN
    v_CityID := NULL;-----giving error in this line
    else
    v_CityID:=p_CityID;
    END;
    END IF;
    end
    begin
    ///some query
    end
    please help someone

    I think there is no added value by putting those Begin/End.
    The simplest solution is just remove them
    Create Or Replace
    Procedure Usp_Add_Update_Insurance (
         P_Cityid In Number Default Null
    ) As
         V_Cityid Number(10,0);
    Begin
         If P_Cityid = 0 Then    
              V_Cityid := Null;
         Else
              V_Cityid:=P_Cityid;
         End If;
         -- do something with V_Cityid    
    End; The only reason for having Begin/End is if you want to catch some exceptions or perform some strange local variable declarations. But it does not seems to be case here.
    MJ

  • Default value of BeX customer Exit variable not Displayed in WeBI??

    Hello Experts,
    We are stuck with a problem where WeBI report is created on top of BeX query and we are not able to see the default value of Bex Customer exit variable in WeBI run. Here is the complete scenario:
    1. One restricted KF is created in BeX, restricted with Customer exit variable on net Due date. And this variable is mandatory, ready for input, and Default value in calculated is user exit as current Week's Monday.
    2. So, by default KF data should be restricted to Monday of current week, if user does not change this value.
    3. Now, WeBI report is created on top of this Bex query, and all is working fine, i.e. we are getting variable as Prompt in WeBI, but Default value is not shown while Running the Webi Report.
    So, need your inputs on the same, if default values from BeX in WeBI is supported or not? If yes, why this is happening, and how to resolve it?
    Please notice, the restrcition is in KF only, it is not a separate restrcition on Net Due date in Filter area or in Defualt area of BeX
    and we are on SAP BW 7.1 and BOXI 3.1 SP4.
    Regards,
    Vipul
    Edited by: VIPUL GOYAL on Nov 23, 2011 9:44 PM

    Hi,
    See 1285993 - Support of Customer Exit Variables from BEx query into WebIntelligence via OLAP universe
    WebI will prompt when executed, but the default values calculated by the user exit  - do not appear.
    Note: If the BEx variable has property 'ready for input' set / enabled, then its WebI prompt shows ok, but no default value appears.
    Cause
    This behaviour expected 'by design' (in the context of the product's current limitations) as explained in the online guide below:
    Please refer to Chapter 7, page 44, document link here: http://help.sap.com/businessobject/product_guides/boexir3/en/xi3_sap_olap_universes_en.pdf
    Characteristic variable > processing type > Customer Exit  is "Supported, without user entry"                                                                               
    -->  This should be understood as meaning "User will not be shown a prompt"
    regards,
    H

  • Default Value in Formula Variable - Inconsistent behaviour

    Hi,
    I am facing a very strange issue in a formula variable.
    I had created three formula variables with default values and the user (Power user who has the Bex access) was able to change the default value themselves for two of these variables.
    Now he wants to change all the three, so I have tried to check the issue and changed all the three for testing purpose.
    Now, he is unable to change any of them!!! Sad, now I cant even say that "You dont have the Auth to do so"
    Any clue? Anyone has faced similar issue.
    Any thoughts are highy welcome! Suddenly users wants to get this one URGENTLY, usually he used to access the report once in month. Now he wants to use the same once in half an hour
    We are on BI 7.0 with SP 24
    Any thoughts PLS
    Regards

    hi,
       probably you can refer to SAP Note 1413030 - SAPBWNews NW 7.x BW Add-On Frontend Patch 1300 - GUI 7.10 or maybe  SAP Note 1294382 - SAPBINews NW7.0  BI Add-On Frontend SP900 - GUI 7.1 that might help you in sorting out your problem, plus you can buy more time from the user as well
    regards
    laksh

  • Default value in recordset variable

    Hi,
    I am using Dreamweaver 8.
    I am not sure that I understand the function of the default
    value in the variable area of the recordset. I'm using a search box
    and sending the result on through the url. If the person types
    something that is not in either of the two fields searched, is the
    default value supposed to kick in? I have tried entering a value of
    something that is actually in the field, but get a broken image
    (x)...I'm displaying images.
    What I would actually do is to display an error message on a
    different page. Is there a SQL statement that could be put after
    the search statement such "if not....go to url or
    something"? If not, I was thinking of creating a blank
    image with wording stating that there was no match.
    Current recordset code:
    SELECT*
    FROM images
    WHERE description LIKE %colname% OR picturenum = colname2
    ORDER BY picturenum ASC
    Name:colname
    Type:Text
    Default Value: montana (an actual word in the database)
    Run-Time Value: $_GET['description']
    Name:colname2
    Type:Text
    Default Value: A091 (an actual image in the database)
    Run-Time Value: $_GET['description']
    Current code works perfectly thanks to some direction by
    David Powers....thanks David.
    Any help would be appreciated.
    Thanks,
    Cliff

    The best way to accomplish this is to build the WHERE clause dynamically, or else have a different WHERE clause that you use in these situations. In other words, test the value of the querystring variables and if they are empty,  use a different WHERE clause that does not include the address  condition.
    Also, this question belongs in the app dev forum.

  • OBIEE 11g Prompt's default value doesn't work with a presentation variable

    Hi, I'm using OBIEE 11g and I have two dashboard prompts (Product Name and Product Number). Theses prompts are hierarquical, so the values that are displayed in the Product Number prompt have dependency with the values chosen on the Product Name prompt. This I was able to do, but now I want to put a default value on the Product Number prompt. The steps are:
    1 - The user chooses the value for the Product Name Prompt and by doing that the Product Number prompt is automatically filled with the correspondent value.
    But unfortunatelly this is not working, after choosing the value for the Product Name the default value for Product Number is not displayed (when you open the prompt the values displayed are correct and already filtered considering the Product Name but the prompt is not automatically filled with the default value).
    What I did is:
    On the Product Name Prompt I've created a Presentation Variable called PROD.
    On the Product Number Prompt I've selected:
    1 - For the "Choice List Values" field I've checked the option "Limit Values by All Prompts"
    2 - For the "Default Selection" field I've chosen the SQL Results option and enter the following SQL:
    SELECT "Products"."Product Number" FROM "Sample Sales Lite"."Products" WHERE "Products"."Product"='@{variables.PROD}
    What am I doing wrong?
    Thank you,
    Carla

    Sorry I was wrong in my previous thread.
    Actually your approach is not correct, Product Number choose constraint that will show as per the selection of Product Name.
    Coming to default value for Product Number you are going for sql override that is okay but not work with variable, instead of setting default values for product number set that to product name.
    if not you need to go for 2 different prompts
    Prompt 1 Product Name hit GO
    Prompt 2 will work based on as you defined earlier with variables
    Hope this helps

  • How to use SYSDATE as a default value of a bind variable in a query report?

    Hi,
    I want to use SYSDATE as default value for a bind variable in Query based report.
    I don't see any way to do it, someone helps?
    Thanks a lot.
    Paulo.

    You can aslo use #sysdate directly.
    Hi,
    The way I'm doing in my report is, I have a database function (f_ret_sysdate) with the following code
    create function f_ret_sysdate return varchar2
    begin
    return to_char(sysdate,'mm/dd/yyyy');
    end;
    Now, in the 'Customization Form Display Options' section of the report I'm calling this function as #f_ret_sysdate in the default value field of corresponding bind variable to display SYSDATE with the format.
    Hope this helps!...
    -Krishnamurthy

  • How to use one variable as a default value for another variable?

    Hi Experts,
    Is it possible to use one variable as a default value for another variable?
    For example:
    Variable 1 = current calendar year month
    Variable 2 = mandatory input ready variable for calendar year month
    I want to use variable 1 as default value for variable 2, but also have the ability to change the month if required.
    Thanks!
    Kathryn

    u can use replacement path variable
    in that case u can replace the values of 1 variable with the another variable...
    but  u cannot do this setting
    u cannot make variable 2 as mandatory
    u cannot enter value for variable 2
    because by default it will take the value of variable 1
    u have to make follow settings
    variable 2
    name , technical name
    processing by = replacement path
    infoobject = ocalmonth
    next tab
    replaced by another variable
    variable name
    offset start , offset lenght
    save and hit okey

  • How to set a default value as current month in already created variable of 0fiscper

    Hi Guys,
    In my report currently we are using a variable for 0fiscper which is mandatory and selection option.
    Now there is a requirement to set current month as default value in that variable.
    Please let me know how can I do that.
    Thanks.
    Dolly

    You need to change the processing type to customer exit of that variable.
    Now in i_step = 1 write the following code:
    Data:dt LIKE sy-datum,
          zper  TYPE /bi0/oifiscper,
          YR type /bi0/oicalyear,
          per LIKE t009b-poper.
    IF i_step = 1.
    WHEN 'X_FSCPRC' .---User input variable based on cmod.
          dt = sy-datum.
          CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
            EXPORTING
              i_date         = dt
              i_periv        = 'M3'---Give the fiscal year variant                             according to your system
            IMPORTING
              e_buper        = per
              e_gjahr        = yr
            EXCEPTIONS
              input_false    = 1
              t009_notfound  = 2
              t009b_notfound = 3
              OTHERS         = 4.
          IF sy-subrc = 0.
    Concatenate YR Per into Zper.
            l_s_range-low = Zper.
            l_s_range-sign = 'I'.
            l_s_range-opt = 'EQ'.
            APPEND l_s_range TO e_t_range.
          ENDIF.
    endif.

Maybe you are looking for

  • OWB WORKFLOW

    Hi All, I have OWB 11g r1(with database 11g r1) installed on my pc,win xp I have created many mappings. Now I want to create a process flow. I searched in GOOGLE It seems that the workflow is not installed. 1) Is workflow not installed by default wit

  • Cleaning  24" imac screen

    i have a 24" imac purchased july '09. i have used iklear -- product reccommended by apple -- in past and worked ok. using it on this new screen leaves a small but detectable cloudy haze. i tried some distilled water on a lint free cloth as well, but

  • DT for mail adapter

    Hi, In my scenario, i have to read an attachment of a mail and use it as a payload. This is how the data in attachment looks like : COMPUTERISED SPARE PARTS ORDER DEALER CD : 10424 ORDER REF : SP/174 DT.18/12/2007 ORDER TYPE : R ITEM CD QTY 12345678

  • ACS 3.3.4 with Linux client

    I've got some problems with a Linux wireless network connection. NetworkManager is installed on the Linux laptop. PEAP profile is created. When the default Character String in ACS points to "Self" or his own IP adress, the Linux client can authentica

  • TS3274 safari keeps closing on my iPad?

    While using my iPad one, it will periodically close down the browser.  I have to reopen it to get back to where I was, including loging in if necessary.