Create local or global variables ?!

hey guys,
I want to use variables instead of wires , which one you suggest , local or global variables? and why ? 
thnxxx alot

blue silver wrote:
I want to use variables instead of wires , which one you suggest , local or global variables? and why ? 
In LabVIEW, the wire is the variable.
Local and global variables have their limited use in certain UI tasks, but lead to inefficient, error prone, and hard to maintain code.
Local variables create extra data copies in memory, which can be expensive
They break dataflow and thus lead to race conditions.
To "fix" the race conditions, you need to clutter your code with sequences.
... it's an evil cycle!.
Why do you think you need local and global variables?
If you "want" to use them, you are probably misguided. Typically, you should only use them if you "need" to! There are legitimate uses for them.
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • Re:- XMII is there a way todynamically create local or transaction variable

    Dear all,
    Is there a way to create local or transaction variable dynamically inside the BLS transactions.
    I have a scenario where in i am reading the XMl document and based on the number of node (sub node ) items i need to temporary save those values into transaction variable .  I want to use these saved transaction variable tvalues o later insert into database

    After reading your second post, I wonder why you want to temporarily store the separate values from the XML node in a local property.
    If you already have all values available in a XML, than it would be easier to process the XML directly in MII, as that is what MII does best. MII can directly access the node values and use it as input for your databse inserts. Using a repeater action, you can process 0 to n nodes. Use XPath to transfer the node values to the query parameters.
    Is this the option you are looking for, or do I miss something?
    Michael

  • Local and global variables in ABAP Debugger

    hi guys.
    we have the following support package:
    SAP_BASIS     640     0025     SAPKB64025     SAP Basiskomponente
    I would like to use in the debugger the local and global variables tab strip, but I can not find it. Is it possible. that our support package is too low for this functionality?
    Thanks a lot.
    rudit
    Edited by: Rudolf Tremmel on Aug 17, 2010 8:35 AM

    Starting with SAP NetWeaver 6.40, SAP released a new version of the Debugger.
    The Debugger available in Release 6.40 was not considered complete (and was
    not the default debugger as a result)
    The Variable Fast Display tool currently has four tabs . The first
    two are provided empty, and you can either type or double click a name in the
    source code to add it to the list. The third tab (Locals) shows all local variables
    for the current program modularization unit, and the fourth (Globals) shows all
    global variables in the current program.

  • How to create and access Global variable in Microsoft Lightswitch(VB)?

    How to create an integer datatype Global variable in Microsoft Lightswitch 2011(VB) and access it in pre-process query to set value? Can it be accessed and set like Me.Application.<MyGlobalVariable> = 999
    Thnx.
    jajjaar123

    If you want to create integer datatype Global variable in lightswitch, you can refer to (Eric Erhardt) blog
    Create and Use Global Values In a Query

  • Labview 8.0 PDA local & global variable cause a crash

    I've attached a pic of the portion of the VI that causes the PDA
    application to crash. What is happening is that I write the initial
    resistance0 to a (global or local) of a chip by using a case
    structure  that sets the value when the while loop first executes,
    afterwards, every other iteration, it sets the resitance to a (local or
    global variable) called resistance then it plots it.. unfortunately,
    accessing the variable
    this way causes it to crash .. Any help would be greatly appreciated.
    Message Edited by GHernandez on 02-09-2006 06:25 PM
    Attachments:
    Problems.jpg ‏162 KB

    I've re-written this application , where i have not included global
    variables for resistance, or resistance0 or the counter. The VI
    executes for maybe a  min or 2 then crashes giving me the
    following error:
    App failed. Error code 560331006. Bad input argument to function.
    unfortunately, this error code does not tell me anything.
    Message Edited by GHernandez on 02-10-2006 04:51 PM
    Message Edited by GHernandez on 02-10-2006 04:52 PM
    Attachments:
    problema.jpg ‏158 KB

  • Local Variables Versus Global Variables

    DATA A TYPE I VALUE 100.
    PERFORM PRINT_DATA.
    FORM PRINT_DATA.
               DATA A(10) TYPE C 'HELLO'.
               WRITE / A. "Wanted to Print 100 (Global)
               WRITE / A.  "Wanted to Print 'HELLO'(Local)
    ENDFORM.
    Note : Both the times, the Local Variable 'A' is Printed .
    ?Is there any way to   Differentiate the Local and Global Variables When the Names Are Same.*
    *It Might be Possible in Object Oriented But I am Looking for the Same in FORMs.

    Hello Gagan,
    You want to print the Global as well as the local values of the variable named "A". Here are a couple of approaches:
    1.The 'Subroutines' are part of the modularization techniques. There are certain keywords like "using" & "Changing" so that you can work by passing Values.
    2. There is a keyword named "LOCAL". Declare data object with the keyword "LOCAL" and then try the 'write" statement. I suppose this should work for you.
    Let me know if any one of the above works or if you need more help.
    Best Regards,
    Chaitanya

  • User Variable in Business Rule or Global Variable

    I wanted to call the User Variable value of Planning application under the Globel Variable of Default Value. Example I have created one Globel variable under the Default value the user varible value need to pickup so any thought how I can do this.
    I know in the Form if you use &UsrVar this will show the user variable value in the Data form but it is not showing the User Variable value in global variable or inside the Business rule.It is giving an error message there is no substitution variable has been defined. Please explain.
    Thanks in Advance,
    Irsh
    Edited by: 818693 on 17 May, 2011 7:22 AM

    Hi,
    User variables are meant to be used in web forms and web forms only. You can certainly pass their values to business rules when you used them in POV or page section of the form during save. All you need to do is to create another business rule (local or global) variable in business rule on the corresponding dimension and use it in your business rule. If you enable running the business rule on save and using the form values for variables options in form properties, business rules would replace the values of business rule variables with the values that are set in user variables.
    Cheers,
    Alp

  • Local Vs Global Index on partitioned table?

    Hello All,
    DESC PS_P1_EMP_QRYSCRTY
    Name Null? Type
    EMPLID NOT NULL VARCHAR2(11)
    EMPL_RCD NOT NULL NUMBER(38)
    ROWSECCLASS NOT NULL VARCHAR2(30)
    ACCESS_CD CHAR(1)
    MY SQL QUERY IS:-
    SELECT DISTINCT OPR.OPRID , EMP.EMPLID ,EMP.EMPL_RCD , OPR.CLASSID ,'Y'
    FROM PS_SJT_OPR_CLS OPR , PS_P1_EMP_QRYSCRTY EMP
    WHERE EMP.ROWSECCLASS=OPR.CLASSID
    This query was taking around 15 mins to run at sql-prompt
    I have created a partitioned table based on PS_P1_EMP_QRYSCRTY :-
    CREATE TABLE PS_P1_EMP_QRYSCRTY_BAK
    TABLESPACE PSNEWTAB
    PARTITION BY HASH(ROWSECCLASS)
    ( PARTITION PART1 ,
    PARTITION PART2 ,
    PARTITION PART3 ,
    PARTITION PART4 ,
    PARTITION PART5 ,
    PARTITION PART6 ,
    PARTITION PART7 ,
    PARTITION PART8 ,
    PARTITION PART9 ,
    PARTITION PART10 ,
    PARTITION PART11 ,
    PARTITION PART12 ,
    PARTITION PART13 ,
    PARTITION PART14 ,
    PARTITION PART15 ,
    PARTITION PART16
    ENABLE ROW MOVEMENT
    AS SELECT * FROM PS_P1_EMP_QRYSCRTY
    I created a local index like on PS_P1_EMP_QRYSCRTY_BAK
    CREATE INDEX PS_P1_EMP_QRYSCRTY_BAK
    ON PS_P1_EMP_QRYSCRTY_BAK(ROWSECCLASS,EMPLID,EMPL_RCD)
    TABLESPACE PSINDEX
    LOCAL;
    The Following is an extract From PS_P1_EMP_QRYSCRTY_BAK
    1ST COLUMN =TABLE NAME
    2ND COLUMN = PARTITION NAME
    3RD COLUMN = NUM OF DISTINCT ROWSECCLASS IN THE PARTITION
    4TH COLUMN = NUM OF TOTAL ROWS IN THE PARTITION
    TABLE_NAME PARTITION_NAME NUM_OF_DISTINCT_ROWSECCLASS NUM_OF_ROWS
    PS_P1_EMP_QRYSCRTY_BAK | PART1 | 25 | 289058
    PS_P1_EMP_QRYSCRTY_BAK | PART2 | 25 | 154537
    PS_P1_EMP_QRYSCRTY_BAK | PART3 | 27 | 364219
    PS_P1_EMP_QRYSCRTY_BAK | PART4 | 33 | 204528
    PS_P1_EMP_QRYSCRTY_BAK | PART5 | 23 | 527974
    PS_P1_EMP_QRYSCRTY_BAK | PART6 | 22 | 277210
    PS_P1_EMP_QRYSCRTY_BAK | PART7 | 23 | 517125
    PS_P1_EMP_QRYSCRTY_BAK | PART8 | 30 | 307634
    PS_P1_EMP_QRYSCRTY_BAK | PART9 | 28 | 523169
    PS_P1_EMP_QRYSCRTY_BAK | PART10 | 38 | 192565
    PS_P1_EMP_QRYSCRTY_BAK | PART11 | 27 | 120062
    PS_P1_EMP_QRYSCRTY_BAK | PART12 | 33 | 407829
    PS_P1_EMP_QRYSCRTY_BAK | PART13 | 37 | 522349
    PS_P1_EMP_QRYSCRTY_BAK | PART14 | 25 | 275991
    PS_P1_EMP_QRYSCRTY_BAK | PART15 | 21 | 259676
    PS_P1_EMP_QRYSCRTY_BAK | PART16 | 23 | 468071
    SELECT DISTINCT OPR.OPRID , EMP.EMPLID ,EMP.EMPL_RCD , OPR.CLASSID ,'Y'
    FROM PS_SJT_OPR_CLS OPR , PS_P1_EMP_QRYSCRTY_BAK EMP
    WHERE EMP.ROWSECCLASS=OPR.CLASSID
    Now when i run this query it gives result in around 5-6 mins
    MY PS_P1_EMP_QRYSCRTY_BAK table contains sumwhat 6 million rows...
    Now My Questions are:-
    1) Is the number of partition done by me optimal under these circumstances...i mean can i get better performance By increasing or decreasing the number of partitions.
    2) I created local index on PS_P1_EMP_QRYSCRTY_BAK.
    Whether creating local or global index will be more beneficial keeping in mind the where clause and Select clause of the query....
    SELECT DISTINCT OPR.OPRID , EMP.EMPLID ,EMP.EMPL_RCD , OPR.CLASSID ,'Y'
    FROM PS_SJT_OPR_CLS OPR , PS_P1_EMP_QRYSCRTY_BAK EMP
    WHERE EMP.ROWSECCLASS=OPR.CLASSID
    i mean in where clause rowsecclass is used thats why i partitioned my table on ROWSECCLASS.
    And in select clause i m selecting EMPLID and EMPL_RCD
    Thats y i made a local index on ROWSECCLASS,EMPLID ,EMPL_RCD .
    Thanks
    --Pradeep                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    1) Is the number of partition done by me optimal under these circumstances...i mean can i get better performance >By increasing or decreasing the number of partitions.
    2) I created local index on PS_P1_EMP_QRYSCRTY_BAK.
    Whether creating local or global index will be more beneficial keeping in mind the where clause and Select clause of >the query....You'll have to see for yourself what is optimal. Every system is different. Here are some ideas, though.
    Your query
    SELECT DISTINCT OPR.OPRID , EMP.EMPLID ,EMP.EMPL_RCD , OPR.CLASSID ,'Y'
    FROM PS_SJT_OPR_CLS OPR , PS_P1_EMP_QRYSCRTY_BAK EMP
    WHERE EMP.ROWSECCLASS=OPR.CLASSIDappears to read all qualifying rows across all qualifying partitions. Since you are partitioning by an id that would appear to exclude range and list partitioning instead so the hash partition is probably the best for your application.
    Regarding global vs local partitions, I have seen timings indicate that global indexes can improve cross-partition queries slighly. I have not worked with partitions for a while but remember that global partition maintenance is difficult; anything the partition structure changes the global index had to be rebuild. You can check the documentation to see if that has changed.
    If possible creating a unique index should give better performance than using an index allowing duplicates.

  • 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

  • Functional Global Variable in the CLAD sample Exam

    Hello,
    A question in the CLAD sample exam #2 keeps puzzling me. It's question number 32 about FGVs:
    32. Which is not an important part of creating a Functional Global Variable?
    a. Using Shift Registers to store information
    b. Changing the VI’s execution settings to Reentrant
    c. Setting the VI to inline into calling VIs
    d. Setting the While Loop to stop after one iteration
    The answer given is the following
    32.Correct Answer: B
    Topic: Functional Global Variables
    Justification: It is not necessary to inline functional global variables into their calling VIs. In fact, inlining requires that the subVI be reentrant, which is forbidden for functional global variables.
    Clearly, for an FGV to work properly, the VI must NOT be reentrant. So I would have selected answer B, but the justification seems to clearly point to answer C as well, doesn't it? Is it a typo, a subtlety in the wording? I am stuck on this one!
    Solved!
    Go to Solution.

    Well, inlining requires reentrant.  Therefore, the best answer should technically be C.  This looks like one of those rejected/retired questions since it isn't quite right and/or left up to too much interpretation.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Global variables in Oracle 8.1.6 on NT

    I am running Oracle 8.1.6 on Windows NT.
    Does anybody know how can I create and maintain global variables or even constants, so that the same variables and constants could be used by all connections to the database.
    The main feature is that I can store their values in database table or external file, but have not to read these values from table or file every time I need them.
    All readings from the source file or table must occur only one time, for example, during database server startup, after it all the values must be supplied directly from phisical memory rather than from the table or external file (to speed up this process).
    Thank you.

    Your answer lies in one of the new features introduced in the Oracle8i: New Features for Administrators course. You can create a function that executes as soon as the user logs in, loading the variables that are required.

  • Global variable readonly

    I chose to try/use a global variable to resolve a complex situation I was having.  I followed the "Creating Global Variables" from LabVIEW help and everything seemed to work fine.  The global stopped working, however, when I checked my files into CM and the xxxGlobal.vi (created by the global variable process) was readonly.  I didn't see a runtime error, but the global always returned the default.  Then, when I changed the file's attributes (enchecked readonly), I could exercise the other functionality.
    Is this a known issue - do I have to make this global.vi read/write for all users, or is there another solution?

    I don't think my conclusion (above) is correct.  I had a case statement error that made it appear that the readonly was the issue, when it was not.  I'm not sure what the deal is now.  Here is what I did.
    I placed a global variable(gv) in the block diagram of one VI, then double clicked on the gv and got a blank vi.  I dropped a text control onto the front panel and named it ReportFormat.  I then did a "save as" to save the new (global) VI.  I then added some logic (where I originally dropped the gv) to populate the global variable with the user's selection from a drop down (two possible choices) .  I then went to another VI and in its block diagram I did a "Select VI", found/selected this global.vi I just created.  Since I only have one item on the front panel (in the global.vi), I received an association to ReportFormat.  I did a  "Change to Read" so I can use the string output to drive a case statement.  The default case is always selected, though.

  • New global variable

    hi!
    Help me please!!! I wont create a new global variable (trx: IMEV) but I don't have a field name correct. how can I insert a missing field in the table  TKESV for the class application?
    Thanks,
    Germano

    hi!
    Help me please!!! I wont create a new global variable (trx: IMEV) but I don't have a field name correct. how can I insert a missing field in the table  TKESV for the class application?
    Thanks,
    Germano

  • User Exits: Global Variables

    Please help me in how to create User Exits: Global Variables
    if there is step by step doc pls send it to my mail id
    [email protected]

    I guess by default (if text is maintained) F4 for calmonth should show you key, short description and long description.
    refer: Variable - Name of month instead of Number
    Edited by: sam hennry on Mar 17, 2008 11:00 AM

  • Create Local Variable in Custom.pll

    Hi,
    I want to create and calling local variable in custom.pll. As i know, we can create local variable with personalization form. but i didn't find the way to create local variable in custom.pll.
    Is there any way to create local variable in custom.pll and calling that variable ?
    Thanks

    I think what you want is to create a GLOBAL variable, a LOCAL variable would be available to the Procedure/Function being executed.  But to create the local variable, you add it between the Function/Procedure declaration and the begin
    PROCEDURE abc(p_input    VARCHAR2);
      v_count       NUMBER := 0;
    BEGIN
    END;
    A GLOBAL reaches out past the execution of the proc defined in CUSTOM.pll.  You can simply type GLOBAL.<var_name> := <value>.
    BEGIN
      GLOBAL.xx_count := 0;
    END;
    Though I like the ability Personalizations give you of using Init Value vs. Value,  Init Value will assign a value if the variable does not exist ... and creates it.  Value just assigns a value.
    Some say you have do a COPY(value, NAME_IN('variable name')) instad of GLOBAL.<variable_name>, I have never had to use this.

Maybe you are looking for