Surprising LV global variable of type 2

I'm using a type 2 global variable because I need a big data array shared by
two parallel VI.
The big data array is contained by an indicator in the front panel because
this big data is an output of the load method.
This big data array is an input of other methods so as in the LV example, a
local variable of the big data array is used as input and I have not wired
the big data array indicator as ouput for these methods in order to avoid to
duplicate my big data array.
The result is surprising because:
After the load method, the outputs are right.
The inputs of an other method is correct (local variable) but the data array
changed although I don't changed it .
So the inputs of the second other method are wrong.
So, I
suppose I have to rewrite my big array at every method call, what lose
a lot of time and memory.
Have you a better idea, please?

> I'm using a type 2 global variable because I need a big data array shared by
> two parallel VI.
> The big data array is contained by an indicator in the front panel because
> this big data is an output of the load method.
> This big data array is an input of other methods so as in the LV example, a
> local variable of the big data array is used as input and I have not wired
> the big data array indicator as ouput for these methods in order to avoid to
> duplicate my big data array.
> The result is surprising because:
> After the load method, the outputs are right.
> The inputs of an other method is correct (local variable) but the data array
> changed although I don't changed it .
> So the inputs of the second other method are wrong.
>
> So, I suppose I have to rewri
te my big array at every method call, what lose
> a lot of time and memory.
Its not exactly clear why you are doing this. A global can't be written
to by
a local, and neither of your options have mentioned a wire going from function
one to function two. I'd suggest that you may not need to use a global
at all,
just a wire.
If you are using a LV2 style global, then you make a call to a subVI
that returns
the needed data on a wire and passes it to the rest of the diagram. This method
doesn't save anything if you are always accessing the entire array.
Greg McKaskle

Similar Messages

  • More details about Surprising LV global variable of type 2

    I'm using a type 2 global variable because I need a big data array shared by
    two parallel VI, so this data array is manipulated in a subVI non reentrant.
    One input of this subVI is an enum called method which represents what
    action to do on the data of the subVI and this input is directly wired to a
    condition structure.
    The big data array is contained by an indicator in the front panel of this
    subVI because
    this big data is an output of the load method so this indicator is wired as
    output connector of the subVI because it is needed when loaded.
    For other method the big data array is read to extract part of needed data,
    so in the subVI diagramm, a readable local variable issued from the big data
    arra
    y terminal is used . But how big data array is not needed for these
    methods, big data array terminal is not rewritten as output in these
    condition diagramms because the big data array is theoretically unchanged
    and I want to avoid to duplicate my big data array to save time and memory.
    The result is surprising because:
    After the load method, the big data array output is right.
    Then, the input of the second subVI call as a get method is correct.
    Readable local variable of the big data array sends right data as input of
    the condition associated with this method, in the subVI.
    Then, the input of the third subVI call as a get method is wrong. Readable
    local variable of the big data array sends wrong data as input of the
    condition associated with this method, in the subVI.
    So, I suppose I have to wire my big array as output of the condition for
    every method call, what lose
    a lot of time and memory.
    Have you a better idea, please?

    Brice Chatelan wrote in message <[email protected]>...
    >I'm using a type 2 global variable because I need a big data array shared
    by
    >two parallel VI, so this data array is manipulated in a subVI non
    reentrant.
    >...
    >For other method the big data array is read to extract part of needed data,
    >so in the subVI diagramm, a readable local variable issued from the big
    data
    >array terminal is used . But how big data array is not needed for these
    >methods, big data array terminal is not rewritten as output in these
    >condition diagramms because the big data array is theoretically unchanged
    >and I want to avoid to duplicate my big data array to save time and memory.
    >The result is surprising because:
    >After the load method, the big data array output is right.
    >Then, the input of the second subVI call as a get method is correct.
    >Readable local variable of the big data array sends right data as input of
    >the condition associated with this method, in the subVI.
    >Then, the input of the third subVI call as a get method is wrong. Readable
    >local variable of the big data array sends wrong data as input of the
    >condition associated with this method, in the subVI.
    >
    >So, I suppose I have to wire my big array as output of the condition for
    >every method call, what lose
    >a lot of time and memory.
    >
    >Have you a better idea, please?
    >
    Brice,
    Are you using a while loop with uninitialized shift-registers in your LV2
    style global. This technique is what defines a "LV2 style global" also
    called functional globals because you can embed actual functionality into
    the VI (for example in your case to extract certain data from an array and
    operate on it) as opposed to the read/write only usage of the built in
    globals.
    From what I can gather, it doesn't sound like you are using the while
    loop/shift-register method. You shouldn't need to use a local variable at
    all. The data is passed around using the shift-register and it passes
    through all of you conditions (load, get, etc.) and no you won't lose time
    and memory (or money) doing it this way, certainly not any more than you
    would using a local variable. Try it and see if it doesn't fix your
    problems and work better than what you are doing now.
    If you are using a while loop and shift-registers, then I'm not
    understanding clearly what you are doing. Perhaps if you emailed me your VI
    (privately of course) to take a look at.
    Good Luck!
    Scott Menjoulet

  • Global variable of type "List" is this possible in BPEL?

    Map filterMap = new HashMap();
    filterMap.put(WorklistService.FILTER_TYPE_TASK_FILTER,
    WorklistService.TASK_FILTER_DEFAULT);
    filterMap.put(WorklistService.FILTER_TYPE_STATUS_FILTER,
    WorklistService.STATUS_FILTER_ASSIGNED);
    WorklistService wlSvc = WorklistService.getWorklistService();
    IWorklistContext ctx = wlSvc.authenticateUser("jcooper", "");
    List tasks = wlSvc.getWorklistTasks(ctx,
    filterMap,
    WorklistService.SORT_FIELD_TASK_TITLE,
    WorklistService.SORT_ORDER_ASCENDING);
    My question is, is it possible to have the variable tasks which is of type "List" to be accessable in another Java Embedding?

    What do you pass to the config variable?
    Arthur My Blog

  • Selection screen values in global variable user exit

    Hi all,
    I made a project report global variable of type 3 (User Exit) and I develop the related code in enhancement KKDR0001 component EXIT_SAPLKYP1_003. In this code I need the value of project definition that user entered on selection screen.
    Does anybody know how can I get this data?
    Thanks!

    Hi,
    You can do the following for getting project in Earlier screen
    Data: l_string(20) type c
    Field-symbols: <fs> type any.
    l_string = '(Screen)variable name'.
    assign l_string to <FS>.
    Just try above...

  • Incorrect value for global variable

    Hi,
    I am facing an issue in a query. In the query there is a Global variable 'Volume type'. In the default value tab of the variable it is given Default value as Litre. In the table RSZGLOBV also i have checked the global variable and there also the 'Internal Characterestic value' is shown as Litre itself. But when I execute the query, it is giving an out put like:
    For the keyfigure Volume,
    If the keyfigure is having some non zero value, it is showing Litre.
    If the kayfigure value is zero, it is showing KG.(which is wrong). For zero also it should display 0.00KG.
    Please help.

    Hi Nitin,
    changing the default within the variable would impact all queries.
    Only if it was an exit variable, you could define within the exit to do different things depending on the query.
    I would suggest the user uses personalization - but this impacts all queries where this variable is used for this user.
    regards
    Cornelia

  • Global variables type

    HI ALL,
             I am creating a global variable(node) and it has 3 attributes say acc-no,bank-key and bank-country......now wat '" type" should be associated with it?

    hi urbashi.........
                    you can give any standard type according to your requirement.
    for ex:
        account : racct or you can also gon with type string for all values. but using string sometimes might throw error while using select queries.
    ---regards,
       alex b  justin

  • What's the difference between global variables and instance variables?

    hi im just a biginner,
    but what is the difference between these two?
    both i declare them above the constructor right.
    and both can access by any method in the class but my teacher said
    global variables are not permitted in java....
    but i don't know what that means....and i got started to confuse these two types,,
    im confusing.......
    and why my teacher said declaring global variables is not permitted,,,,,,
    why.....

    instance variables are kindof like Global variables. I'm not surprised you are confused.
    The difference is not in how they are declared, but rather in how they are used.
    There are two different "styles" of programming
    - procedural programming.
    - object oriented programming.
    Global variables are a term from Procedural programming.
    In this style of programming, you have only one class, and one "main" procedure. You only create one instance of the class, and then "run" it.
    There is one thread of control, which goes through various methods/procedures to accomplish your task.
    In this style of programming instance variables ARE "global" variables. They are accessible to all methods. There is only one instance of the class, and thus only one instance of the variables.
    Global variables are "bad" BECAUSE you can change them in any method you like. Even from places that shouldn't have to. Also if you use the same name as a global variable and a local variable, you can cause great trouble. This can lead to very subtle bugs, as the procedures interact in ways you don't expect.
    The preferred method in procedural programming is to pass the values as parameters to the methods, and only refer to the parameters, and local variables. This means that you can track exactly what your method is doing, and what it affects. It makes it simpler to understand. If you use global variables in your methods, it becomes harder to understand.
    So when are instance variables not global variables?
    When you are actually using the class as an Object, rather than just a program to run. If you are creating multiple instances of an object, all with different values for their instance variables, then they are not global variables. For instance you declare a Person object with an attribute "firstname". Your "main" program then creates many instances of the Person object, each with their own "firstname"
    I guess at the end of all this, it comes down to definitions.
    Certainly you can write procedural code in java. You can treat your instance variables, for all intents and purposes like global variables.
    I can only think to show a sort of example
    public class Test1
       User[] users;
       public void printUsers(){
         // loop through and print all the users
         // uses a global variable
          for(int i=0; i<users.length; i++){
            users.printUser();
    public void printUsers(User[] users){
    // preferred method - pass it the info it needs to do the job
    for(int i=0; i<users.length; i++){
    users[i].printUser();
    public Test1(){
    User u1 = new User("Tom", 20);
    User u2 = new User("Dick", 42);
    User u3 = new User("Harry", 69);
    users = new User[3];
    users[0] = u1;
    users[1] = u2;
    users[2] = u3;
    printUsers();
    printUsers(users);
    public static void main(String[] args)
    new Test1();
    class User{
    String firstName;
    int age;
    public User(String name, int age){
    this.firstName = name;
    this.age = age;
    public void printUser(){
    // here they are used as instance variables and not global variables
    System.out.println(firstName + " Age: " + age);
    Shit thats a lot of typing, and I'm not even sure I've explained it any good.
    Hope you can make some sense out of this drivel.
    Cheers,
    evnafets

  • Use of global variables like g_cnt_transactions_transferred in the LSMW

    Hi SapAll.
    when i had a look at the some of the LSMW's whic use IDOC as the object of uploading data into SAP from external Files i have found in the coding under the step "Maintain Field Mapping and Conversion Rules" that they use some of the global variables like below
    .if p_trfcpt = yes or sy-saprl >= '46A'.
      EDI_DC40-DOCNUM = g_cnt_transactions_transferred + 1.
    endif.
    .EDI_DC40-CIMTYP = g_cimtyp.
    .EDI_DC40-MESTYP = g_mestyp.
    .EDI_DC40-MESCOD = g_mescod.
    .if p_filept = yes.
      EDI_DC40-SNDPOR = g_fileport.
    elseif p_trfcpt = yes.
      EDI_DC40-SNDPOR = g_trfcport.
    endif.
    my doubt is where i can find these variables 'g_cnt_transactions_transferred ','g_cimtyp','g_mescod','g_fileport','g_trfcport' in the LSMW and what is the use of the variable  'g_cnt_transactions_transferred ' in the LSMW.
    I have treid to find out the above listed variables looking in step 'Maintain Field Mapping and Conversion Rules' under global variabels list and the other lists also but i couldnt found.
    can any one help me in this ?
    regards.
    Seetha.

    Hi Seetha,
               In the LSMW Workbench go to the option user menu.  And check the option display conversion program.
    Now when you execute with the radio button on dislplay conversion program, you ll see the code that got generated in the background while you built your LSMW.
    The global variables that you have mentioned are bound to be there in this program generated in the background..
    You can put a break point here and see for yourself what the value of these global variables are at runtime.
    File port, TRFC port , no. of transactions executed by one run of the LMSW Idoc program , message type are some of the fields that you have asked for .
    Regards,
    Arun

  • Can F4IF_INT_TABLE_VALUE_REQUEST FM return a value in a global variable?

    Hi everybody,
    I need to use F4IF_INT_TABLE_VALUE_REQUEST FM because I have to let users select an specific option before choosing another value. The point is that I need to save in a program global variable what the user selects, and decide something with it in the program.
    Is it possible that F4IF_INT_TABLE_VALUE_REQUEST FM returns the value in a sinple variable or it has to be paramter?
    I look in a lot of previous threads but I didn't find anything, and I don't know if it's possible.
    Thanks and kind regards,
    MMP.

    Hi,
    Sure you can. All you need to do is to store what the function returns in your global variable. It don't need to be returned back to screen field.
    DATA: BEGIN OF VALUES OCCURS 0,
             CARRID TYPE SPFLI-CARRID,
             CONNID TYPE SPFLI-CONNID,
           END OF VALUES.
    DATA: VALUES_TAB TYPE TABLE OF VALUES,
              G_VALUE TYPE SPFLI-CONNID.  "global variable to store what is returned
    "in PAI first populate your table
      SELECT  CARRID CONNID
        FROM  SPFLI
        INTO  CORRESPONDING FIELDS OF TABLE VALUES_TAB
        UP TO 10 ROWS.
    "then call the function but don't return the value to screen field
    "If you specify the import parameters DYNPPROG, DYNPNR, and DYNPROFIELD, the useru2019s selection is
    "returned to the corresponding field on the screen. If you specify the table parameter RETURN_TAB, the
    "selection is returned into the table instead.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
           EXPORTING
                RETFIELD         = 'CONNID'
                VALUE_ORG        = 'S'
           TABLES
                VALUE_TAB        = VALUES_TAB
                RETURN_TAB      = RETURN_TAB.
    "now simply read first row of return tab and store the value returned there in some global var
    READ RETURN_TAB INDEX 1.
    MOVE RETURN_TAB-FIELDVAL TO G_VALUE.
    Regards
    Marcin

  • How to print global variable in smart form table cell

    hi,
    i have smartform and i insert table in it, i also have set global variable, i want to show variable in table cell.
    regards
    shahid rais

    Hi Shahid Rais 
    You can use this global variable that has been declared in anywhere as you like.
    For displaying global variable in table lines, You can first set the column and row of the table by using the table tab in table node . Then, u can decide either the variable u want to used will be placed on header, main, or footer. After that, right click on one of the table part, and choose create table line. After choosing the correct line type as already been declared in the table painter, just simply right click on the table cell, and then create text node.
    You can now enter your variable by using "insert field".
    And don't forget the & & signs before and after your variable name.
    Regards,
    William Prawira

  • Function module Global variables not cleared from memory?

    Hi,
    This is may be simple & stupid question ( after posting  4242 posts ):)
    " Declaration in TOP
    data : begin of i_y1yatt occurs 0.
            include structure y1yatt.
    data : end of i_y1yatt.
    types: begin of t_yatt71.
           include structure yatt71.
    types: tcode like sy-tcode.
    types: dflag type c.
    types: end of t_yatt71.
    data : i_yatt71 type standard table of t_yatt71
                   with default key  with header line  initial size 0.
    This is code in the function module.
      loop at i_y1yatt.
        move-corresponding o_y1yatt to i_yatt71.
        if i_y1yatt-werks eq 'N501'.
           move space to i_yatt71-werks.
        endif.
        append i_yatt71. 
        " Here this internal contains the previous entry
        clear i_yatt71.
      endloop.
    This function module is called 25 times in a minute.
    My problem is this
    For example : 1st tranmission is called this fm with 50 records,
    and 2nd tranmission is called fm with 10 records.
    My results are showing
    last record in the 1st transmission is still on the memory while calling 2nd transmission.  ( Here in int table I_YATT71 still contains the 1st transmission's last records during the 2nd tranmission call)
    As per my knowledge if each time calls comes in to fm all gloabl variables get cleared. but some how this not happening.
    Anybody come across this scenario.
    PS. I know i need to use clear statement within the loop as first statement.

    You must understand that when calling a FM, you load the entire function group into memory. IF there are global variables, then they are "alive" for the entire duration of the program execution. Meaning if you call the function numerious times, or even if you call another function within the same function group, the functions still have access to that same global variable space, so it must always be cleared manually by the developer at the required points.  You can not rely on the runtime to clear the global variables at the end of the function call.  So you should clear all you globals as the first operation in your function module call, if that is what is required.
    Is this clear?
    Regards,
    Rich Heilman

  • Setting the value of an Application Item (setting a global variable);

    In APEX 3.2.0.00.27, I need to initialize a global variable to 0 to implement a variable for testing to see if anything on the page has changed. Will update to 1 when certain select lists on the page are changed. Have read through some similar questions and replies within the forum as well as other blogs and sites. So, I believe what I am doing is the way to go about this. Unfortunately, my initialization of an application item/global isn't happening yet. here's a rundown of what has been implemented:
    1) created an application item, G_CLASSIFICATION_ID_NEW in the shared components;
    2) created Javascript (JS) function called by addLoadEvent in the page html header region so when the page loads, the G_CLASSIFICATION_ID_NEW global/application item should get set to 0 with the following JS and using AJAX and htmldb_GET:
    <script type="text/javascript">
    function initVars()
    alert("before get initvars");
    var get = new htmldb_Get(null,$x('pFlowId').value,null,22);
    get.add('G_CLASSIFICATION_ID_NEW', 0);
    gReturn = get.get();
    if(gReturn){
    alert(gReturn.value);
    get = null;
    alert("after get initvars");
    alert("before call to initpage");
    addLoadEvent(initVars());
    </script>
    I've used the htmldb_Get with success for populating other global variables and running On Demand Processes with onchange JS calls in the html form element attributes within select lists on the page. Afterwards, I can check the globals via the Session window and searching on Application Items. Unfortunately, I'm missing something because my G_CLASSIFICATION_ID_NEW never gets populated when I load the page. The alerts all popup when the page is loaded, so I know the script is being executed when the page loads. the alert(gReturn.value) comes back undefined. And, needless to say, the G_CLASSIFICATION_ID_NEW to 0 is not occurring.
    I've tried the htmldb_Get with it calling an application process and without (set to null). From what I've read, you shouldn't need to call an on demand process to have the get.add set the global variable. Then again, this could be where I'm going wrong. however, as I've mentioned, this works for other functions called from an onchange to populate an application item, but the page has already loaded when the onchange(s) get executed. They may work because the page is already loaded when the onchange is called. My point here is that my other On demand processes are NOT setting or changing the global variables at all. The globals are getting set with the get.add(<app item>, <value>) portion of my other JS functions within the HTML Header region. So, I'm inclined to believe that I don't need the 'application_process=<some_odp>' parameter set, but if that's not true, please let me know. if so, what would need to be in the on demand process--ie, what would be the purpose of the get.add(<application item>, <value>) if I set the global variable in the on demand process because that's the only thing I could think of doing within an on demand process for this?
    If somebody can point out what I'm not understanding or failing to do here, that would be great. I'm doing fine with APEX, but wouldn't consider myself a guru with it just yet. I'm definitely not a JS/AJAX guru, and when things like this go astray, I get bogged down because I'm not sure of the problem. So, I'm hoping you gurus who monitor this forum can get me going in the right direction.
    thanks,
    bob

    Hi Jari,
    Does that javascript work if you place it some of region footer on page 22 ?Yes. I cut it out of the html header of the page, and put it in the footer of the first region on the page. It initializes the variable. Putting it into the footer of the first region on the page should work for me instead of having an extra region on the page that's being picked up from page 0.
    Is your page 22 authentication public ?No. This particular page is set for an ADMINISTRATOR only. That said, I am logged in as an administrator. So, I cannot see why setting authentication should make a difference as long as I have that authentication/authorization. Also, there will be other pages where I want to use this script or a similar script, but again, those pages will not be open to the public. the authentication will be "role" based where a user will not necessarily have to be an administrator, but they will have to have a certain role to access the page. Is there a known problem or something that precludes a html header JS script from doing an addloadevent when authentication is NOT public?
    thank you,
    bob

  • How do you reference a created global variable in a report text field?

    I have created a parameter using the Globaldim statement in a script file. when I reference this parameter in any other script file during the current DIAdem session the value is passed without any issue.  Call the variable parmxyz where I assign it a value of 25.3 
    The help section under Globaldim mentions that global variables can be referenced in all panels, scripts, and dialogue boxes.  When I try to insert a text box on a report page using the @@parmxyz@@ it returns NOVALUE where I expect to see 25.3 (for example).
    When I substitute @@CurrDate@@ I do get the date, so I know the text box is valid.  What am I doing wrong?
    Steve    M 

    Hello Steve!
    It should work the way you did it. But their are some circumstances wich might prevent it:
    You have reseted the global script engine. All variables will be lost.
    You have a Sub with the same name in a command extension script. There is no warning ;-)
    One Test you can make is to put in '@@TypeName(paramxy)@@' as the expression to see the variable type. You can also try a realy unique variable name. The last option is to use ItemInfoGet to get detailed infos about your variable.
    Matthias
    Matthias Alleweldt
    Project Engineer / Projektingenieur
    Twigeater?  

  • Duplicate line in Global variable

    Hi Experts,
    I have one BODS job which will load the data from BW to Non SAP.  As per my business requirement I have to trigger this job from BW Process chain. For that I have added BODS job in Process Chain Variant and given input to global variable before execute the PC, it was working fine. Now I want to change the Global parameter value for that I open the PC variant it was showing multiple line items and I am not able to run this from Process Chain. Please help me if anybody faces this issue.
    Version: BW 7.3
    BODS Version : 4.1 SP2
    Regards
    M Ramesh

    Hi All,
    When you use the process type "Start job in SAP BusinessObjects Data Services" in a process chain , in the variant maintenance there are duplicate entries created in the global variables. This is due to a Internal Program error. 
    Apply note 1989821 ( Duplicate entries in Global variables for BOBJDS job in process chain)
    Regards
    M Ramesh

  • How to get the value of the global variable of test stand in labview User interface?

    Hi.
     Can anyone Please share examples and tell me to how access the test stand global variable using labview user interface.
    Solved!
    Go to Solution.

    I'm not surprised that what you are doing doesn't work.  The Start Execution UI Message is triggered when the user clicks a button to start an execution.  Realize that most executions go through a process model.  So you could be looking at the sequence context of the process model and not your client sequence file.
    I recommend reading that link I posted above.  UI Messages are your best bet but you cannot just piggy back on an existing UI Message like this.  They may not be getting sent at the time you need them to be.  The only way to ensure you get what you want is to trigger one yourself at the right time.
    Regards,
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~

Maybe you are looking for

  • Can I create other visualization components using OLAPResult from the OLAPQuery on a OLAPCube?

    Hi, I have a OLAPCube/ schema defined. I am executing a OLAPQuery on the Cube. With the result from the query execution, I can create OLAP Data Grid. But I want to know if I can draw any chart from the same result. If yes, then please let me know the

  • Creating a contact in Active Directory

    Hello, I'm new to LDAP and I'm having trouble creating a contact in AD. When I try to create the contact I recieve: Problem creating contact: javax.naming.OperationNotSupportedException: [LDAP: error code 53 - 00002040: SvcErr: DSID-030508F8, problem

  • Error # -2093 after installing and running latest Quicktimeplayer 7.3.0.70

    On my Toshiba Satellite 1550CDS laptop which has been upgraded with a K6-III+ CPU @ 500Mhz, 160MB ram and running WinXP Pro+SP2 with all latest updates, I've installed and deinstalled several times already and always I get Err # -2093 about 5 minutes

  • Do I need the english version or do all versions have an english option?

    I got the German version of Snow Leopard by mistake and I'm just wondering if I can install it and choose English as the language or do I need to send it back and get a replacement English version? Don't want to break the plastic seal to check just i

  • Solaris 8 x86: Problems with VNC

    I have installed Solaris 8 x86 on my "slave PC" and now I want to access it remotely from my "master PC". The networking runs well so far. Ping, telnet, and internet access are all possible. Now I have installed the tightVNC 1.2.9 package on the Sola