Why do global variables have a .vi extension?

Hi,
While cleaning up some code the other day, it occured to me that although Virtual Instruments and Global Variables are distinct entities with separate roles in the LabVIEW environment, they share the same file extension .vi. It seems much more logical to assign a unique extension like we already do for controls, menus, classes, etc.
Can anyone explain why it's done this way?
Thanks!
Solved!
Go to Solution.

No terminals on a global's BD.  Just a blank slate.  You CAN put stuff there but if there is any reference to a FP object LabVIEW will blow up on you so there is no real easy way to pass data in or out. (I once thought of embeding a counter into a global-  It was not pretty)
Regardless, no matter what you COULD do, there must be another legitamate way to do the same thing.  Its basically "Trickery or witchery."  Do that kind of thing at your own risk! (Don't try this at home- We are professionals)  Since you shouldn't be there, there are fewer protections.  BAD things CAN and likely WILL happen.  Think of it like triing to drive a car on two wheels.   Its possible but, perhaps you want to try it with a really cheap car and know someone good with body repair.
Jeff

Similar Messages

  • 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 .

  • Global Variable Declaration in PI 7.1 EHP 1

    Hi Experts
    How can I declare the Global Variables in PI 7.1 EHP 1 , please let me know if there is any blog in Enhancement Pack 1
    Thanks
    PR

    On PI7.1 global variables have been removed.
    You can try one of the following:
    1. Create a global variable within an UDF;
    2. Use the solution from the blog below:
    /people/william.li/blog/2008/02/13/sap-pi-71-mapping-enhancements-series-using-graphical-variable

  • Global Variables Vs Form Library Package Variables Vs DB Package Variables

    I realise this question has been asked a few times with varying degrees of answers, but I am still seeking comment/advice from others.
    I am aware of following options for retaining persistent data to share between forms.
    1. Package variables in a library that you share in a session.
    This requires usage of SHARE_LIBRARY_DATA, there is risk that this not set, then does not share data.
    2. Package variables in a database package.
    Requires round trip to DB. Is this expensive for performance?
    What about risk of DB package becoming invalid and losing state?
    3. Use global variables
    Can be tricky to manage.
    4. Use parameters
    Only one way, ie called form cannot alter value that caller can see.
    Packages are closest to OO approach in using get and set modules. Allows all variables to be managed in one location. This appears best practice.
    Forms library packages appear risky if caller does not include SHARE_LIBRARY_DATA.
    DB packages have cost of round trip to DB. Does this become expensive is have to reference many times. Also topic of DB package becoming invalid and losing state?
    Forms global variables have regular disadvantages of globals, ie not sure who may modify. Need to manage carefully. Text only
    As a second related question, for value such as current user, for performance (and maintainability) is it better to obtain this from oracle user function each time, or save somewhere (in one of options above) and use that saved value each time.

    My personal opinion:
    I like the "packaged" version with getters and setters. In general, i create a client-side package in a pll which has methods to access the value by getters and setters. With that, the "implementation" is encapsulated and doesn't really matter to the rest of your system. All modules have to access the value using the getter and setter.
    Inside the procedure i use two approaches:
    1. If its for communication purposes between different forms i use globals, which are filled or extracted in the getter and setter (see this http://andreas.weiden.orcl.over-blog.de/article-28180655.html )
    2. If its for someother purpose where the value should be "session persistent" i use a database package with getters and setters, which are called from the client-side package getter and setter. If the value is quite "constant" throughout the session, i read the value once at initialization code of the client-side package and the getter just returns that "cached" value
    Hope this helps.

  • Duplicate sub vi with the same global variable

    This is a simple question, that probably was answered before:
    I had a sub vi that uses a global variable. Now I need two of these sub vi's working simultaneously in a while loop. The problem is that they are both adressing the same global variable, but I need them to be isolated. How do I do that?
    Thank you.

    Hi Ivan,
    This Developer Zone article explains a little more background about why functional global variables are the best option for you. Happy coding!
    Amanda Howard
    Americas Services and Support Recruiting Manager
    National Instruments

  • Static used on global variable declaration

    I have inherited a CVI project that contains a single .C file and a couple of .UIR files with their associated .H files.
    Many of the global variables have STATIC in their declaration - I believe this is due to the fact the original developer originally had them inside various functions and at some point changed strategy to make them global, leaving the STATIC keyword in place when copy/pasting.
    As I understand it the ONLY implication of STATIC on a global variable would be to keep its visibility only to the .C file in which it is declared. In this instance that is moot since there is only one .C file in the project.
    Is there anything about LabWindows/CVI which I might not be aware of that makes this use of STATIC cause something different than if STATIC were not used?
    Thanks for any input you might have since I'm new to CVI

    Roberto and menchar said it well:
    "static variables are declared at compile time and survive when their block of code terminates. If declared at function level, their value survives from one call of the function to another, so that they can be used over time to store permanent values locale to the function. If declared at module level, they are common to all functions in the module and are allocated outside the stack so that their values are not lost during program life. In every case they can be accessed and modified in values by functions in the program. If arrays, they cannot be dinamically changed in size."
    "The static keyword can be used with a function name also, meaning the function name isn't exported to the linker, and the function is in scope only to code within the module."

  • Why does Labview create a .vi for each global variables?

    Hello,
    I wrote an Labview application which use several global variables (almost 30 variables). All the variables are of variable type "single process". For each of these variables, Labview creates a vi.
    For example, for the variable "_TS.Measures.channes", Labview creates a vi named "TS_'_TS.Measures.channels'.vi". Which means, I have almost 30 "name of variable".vi files: this is confusing!
    All my VI are inside library (.llb). When I try to put the VI of a global variable in a library, Labview can't find them anymore.
    May be can somebody explain me, why LabVIEW does create these VI and how is it possible to put them in a library.
    Cheers,
    Risotto

    Hi everybody,
    Thank you for your answers, I get a lot of informations.
    Yes, I use the new shared variables in LabVIEW8, which I am using like sort of global constants. Now I am understanding what guys are telling me all this about global variables in LabVIEW7.1. Sorry, I forgot to say I was using LabvVIEW8.
    I will have a look on the tutorial too.
    But yet one point about the library collecting all the shared variables in the windows explorer and in the project explorer: When I create a shared variable in my LabVIEW project - for example "test1" as double/single process - the variable doesn't appear in my file directory, but it appears in the project explorer in a library (.lvlib).
    When I drag/paste my shared variable on the block diagramm of my VI, then a file "Math_test1.vi" appears in my file directory. There is no extra .llb created to contain my shared variable vi.
    If I drag/paste the file "Math_test1.vi" in the Math.llb (see picture), then the file is moved in the llb and disapeared from the directory.
    If I created another shared variable "test2" as double/single process and put it on the VI, then LabVIEW creates2 files in the directory: "Math_test1.vi" and "Math_test2.vi". So that I get 2 vi for the "test1" variable now (one in the llb and one in the directory).
    I use several library in the project explorer. But the  library in the project explorer seems to create file with other extension (.lvlib) than the sdtandard LabVIEW library (.llb).
    Cheers,
    Risotto
    Attachments:
    picture.jpg ‏223 KB

  • SAP BODS XI 3.2 - batch job, global variable, name includes apostrophe - why failing?

    Global Variable in batch job used to define user access (add/update/remove) - how do we handle the inclusion of an apostrophe in a name?
    Tested with wildcard prior to apostrophe, still failing.
    Any clues, please?
    Thank you.

    I believe you can not use any special characters in global variables name.

  • Java Threads vs. Native Global Variables

    A brief description of the problem:
    I am trying to integrate a multi-threaded Java app with legacy Fortran code. The Fortran code in question makes extensive use of global variables in the form of Fortran's Common Block data structure.
    If multiple threads were allowed access to a native routine, they would over write each others data which is stored in global variables.
    If only one thread at a time can have access to the native routine for the duration of the native routine, the whole advantage of using threads is completely nullified.
    These native routines cannot be rewritten (3rd party code) and must be used.
    One solution I envisioned was to load a new copy of the native shared object code for each Java object that used the native code. However, it seems System.loadLibrary() can only be used in a static context.
    Is there any known solution to this problem?

    Here is an elaboration on the earlier suggestions. It's a high overhead solution, because you have to start a bunch of JVMs.
    1. You have a java control program, which will start up a pool of "services", make requests to them, and gather the results.
    2. Each service is a small java program with a native method:
    o java communications front-end.
    o native method declaration.
    o native - in your case fortran - method implementation.
    3. Each service is started using "exec". That puts it in a separate process.
    4, Since each service is a java program, you can use java to do communications between the control program and the service.
    o You could use RMI.
    o You could - perhaps - use java Process communications, i.e., have the services write to stdout, and have the control program capture the output.
    o You could use socket communications.

  • Unit Testing and APEX Global Variables

    We've recently started to unit test our database level PL/SQL business logic.
    As such we have a need to be able to simulate or provide output from PL/SQL APEX components in order to facilitate testing of these components.
    Some of the most obvious portions that need simulation are:
    1. The existence of a session
    2. The current application ID
    3. The current page ID.
    We currently handle requirement #1 by using apex_040100.wwv_flow_session.create_new
    We handle 2 and 3 using the apex_application.g_flow_id and g_flow_step_id global variables.
    I'm just wondering, how safe is it for us to use wwv_flow_session.create_new to simulate the creation of a session at testing time for those things which need a session?
    I've also noticed that there are apex_application.get_application_id and apex_application.get_page_id functions whose output is not tied to the global variables (at least in our current version).
    Is it safe for us to expect that we can set these global variables for use in testing or is apex moving to get_application_id and get_page_id functions away from global variables?
    Will there be corresponding set_application_id and set_page_id functions in the future?
    Sorry for the question bomb. Thanks for any help.

    My first question would be why do you need to establish a session to test your PL/SQL?
    wwv_flow_session is a package internal to APEX, and you should probably leave it be.
    The get_application_id procedure you refer to is in apex_application_install, which is used for scripting installation of applications - not get/set of page ID like you're describing.
    If you're uncomfortable using apex_application.g_flow_id, you can use v('APP_ID') or preferably pass the app_id/page_id as parameters to your procedures.
    Your question seems to have a few unknowns, so that's the best I can describe.
    Scott

  • Loading a text file into a global variable issue - really a global var?

    From all the documentation and examples I can find, it appears that it would be
    correct to create a global array variable [outside of any functions] to load image names into,
    then use these images for a slideshow. I want to make the app dynamic, in that changing the text file gives a new set of images.
    The global variable goes null [no values] after the load event listener. Why is that?
    Isn't global, well global, and alive for the duration of the SWF?
    PARAMS.TXT:
    monthNames=January,February,March,April,May,June,July,August,September,October,November,De cember&dayNames=Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday
    CODE:
    var dNames:Array = new Array();
    var mNames:Array = new Array();
    var request:URLRequest = new URLRequest("images/params.txt");
    var variables:URLLoader = new URLLoader();
    variables.dataFormat = URLLoaderDataFormat.VARIABLES;
    variables.addEventListener(Event.COMPLETE, completeHandler);
    try
    variables.load(request);
    catch (error:Error)
    trace("Unable to load URL: " + error);
    trace("2 mNames 2: " + mNames[2]);
    trace("2 dNames 3: " + dNames[3]);
    stop();
    function completeHandler(event:Event):void
    var loader:URLLoader = URLLoader(event.target);
    dNames = loader.data.dayNames.split(",");
    mNames = loader.data.monthNames.split(",");
    trace(loader.data.dayNames);
    trace("1 mNames 2: " + mNames[2]);
    trace("1 dNames 3: " + dNames[3]);
    OUTPUT:
    2 mNames 2: undefined
    2 dNames 3: undefined
    Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday
    1 mNames 2: March
    1 dNames 3: Wednesday
    How do I access these values after loading from the external file, after the load?
    Thanks in advance.

    The statement you quoted from whatever Adobe documentation is correct.
    If you want to load the data into the arrays before anything else happens, then have anything else that happens execute via the completeHandler function... after the data is loaded and processed into the arrays.
    the command: loadFile() executes before the trace("2:" +images[4]); command.  The loadFile function is processed and the loading process BEGINS... but starting the loading does not delay the main processing from continuing down the line--the loading itself becomes a secondary/background task.  The command was to execute the loadFile function and the processing of that function was completed.  If you don't believe so, then add a trace...
    function loadFile():void
         vars.dataFormat = URLLoaderDataFormat.VARIABLES;
         vars.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
         vars.load(new URLRequest("images/fnames.txt"));
         trace("started loading");
    If you add that trace, you should see that the loadFile function execution is completed and the next line in your code is then processed... trace(2....)
    The addEventlistener does not stop anything.  The addEventListener code is assigning a monitor, not a traffic controller... it is telling the monitor to indicate when the data has finished loading.  It is not telling anything to stop program execution.
    So if you want to wait until the data is loaded before you do anything else... it goes....
    function onComplete(evt:Event):void
         var urlVars:URLVariables = evt.target.data;
         images = vars.data.images.split(",");
         tnails = vars.data.thumbnails.split(",");
         ................HERE.................

  • How to Use Transient View Objects to Store Session-level Global Variables

    hi
    Please consider section "40.8.5 How to Use Transient View Objects to Store Session-level Global Variables"
    at http://download.oracle.com/docs/cd/E14571_01/web.1111/b31974/bcstatemgmt.htm#ADFFD19610
    Based on this documentation I created the example application
    at http://www.consideringred.com/files/oracle/2010/ProgrammaticalViewObjectAndRollbackApp-v0.01.zip
    It behaves as show in the screencast at http://screencast.com/t/qDvSQCgpvYdd
    Its Application Module has a Transient View Object instance "MyEmployeesContextVOVI", as master for the child View Object instance "EmpInCtxJobVI".
    On rollback the Transient View Object instance keeps its row and attribute values.
    Also when passivation and activation is forced (using jbo.ampool.doampooling=false ) the Transient View Object instance seems to keep its row and attribute values.
    questions:
    - (q1) Why does the expression #{bindings.MyEmployeesContextVOVIIterator.dataControl.transactionDirty} evaluate as true when a Transient View Object instance attribute value is changed (as shown in screencast at http://screencast.com/t/qDvSQCgpvYdd )?
    - (q2) What would be a robust approach to make a Transient View Object instance more self-contained, and manage itself to have only one single row (per instance) at all times (and as such removing the dependency on the Application Module prepareSession() as documented in "5. Create an empty row in the view object when a new user begins using the application module.")?
    many thanks
    Jan Vervecken

    Thanks for your reply Frank.
    q1) Does sample 90 help ? http://blogs.oracle.com/smuenchadf/examples/
    Yes, the sample from Steve Muench does help, "90. Avoiding Dirtying the ADF Model Transaction When Transient Attributes are Set [10.1.3] "
    at http://blogs.oracle.com/smuenchadf/examples/#90
    It does point out a difference in marking transactions dirty by different layers of the framework, "... When any attribute's value is changed through an ADFM binding, the ADFM-layer transaction is marked as dirty. ...".
    This can be illustrate with a small change in the example application
    at http://www.consideringred.com/files/oracle/2010/ProgrammaticalViewObjectAndRollbackApp-v0.02.zip
    It now shows the result of both these expressions on the page ...
    #{bindings.MyEmployeesContextVOVIIterator.dataControl.transactionDirty}
    #{bindings.MyEmployeesContextVOVIIterator.dataControl.dataProvider.transaction.dirty}... where one can be true and the other false respectively.
    See also the screencast at http://screencast.com/t/k8vgNqdKgD
    Similar to the sample from Steve Muench, another modification to the example application introduces MyCustomADFBCDataControl
    at http://www.consideringred.com/files/oracle/2010/ProgrammaticalViewObjectAndRollbackApp-v0.03.zip
    public class MyCustomADFBCDataControl
      extends JUApplication
      @Override
      public void setTransactionModified()
        ApplicationModule vApplicationModule = (ApplicationModule)getDataProvider();
        Transaction vTransaction = vApplicationModule.getTransaction();
        if (vTransaction.isDirty())
          super.setTransactionModified();
    }Resulting in what seems to be more consistent/expected transaction (dirty) information,
    see also the screencast at http://screencast.com/t/756yCs1L1
    Any feedback on why the ADF Model layer is so eager to mark a transaction dirty is always welcome.
    Currently, question (q2) remains.
    regards
    Jan

  • How can I pass a value field to a global variable?

    I have a doubt,
    I wnat to know if is possible to pass a value field to a global variable inside of DataFlow?
    That a try to do is at the time to execute a JOB on line (real time), depending of the value field that i receive, only certain DATAFLOWS will be executed  depending of the value field.
    I hope you can help me.
    Kind regards!!!

    It can be done via various ways, your approach is kind of odd, though.
    You are saying you have one kind if Input message, depending on the flag you want to do different transformations. The way you envision that is by loading that flag into a global variable and use different dataflows then.
    Can you use different dataflows within one Realtime Job? Yes, usually the first loads an in-memory datastore.
    Can you write into a global variable? Yes and No. Not directly, but you can write the value into e.g. a database and using the sql() function read it from there. But why would you. You could write it into the in-memory datastore. And then you run your n dataflows, each has a filter. So only one of these dataflows will actually process the data.
    Are there other approaches? I would have a Case transform at the beginning and route the data into different queries depending on the data. So all in one dataflow. Your approach is fine for a batch dataflow where a dataflow is started, does something and then ends. But that's not how it works in Realtime!

  • How can I access global variables in a loaded Applescript?

    How can I access global variables in a loaded script, in Xcode, ApplescriptObjC? Basically, I have a global variable defined in my parent script using "property", and I need to modify objects connected to those variables inside of a loaded script.
    Example:
    Parent script:
    script AppDelegate
    property myTextField : missing value
    //linked to a text field object
    tell myScript to myAwesomeHandler_()
    end script
    Loaded script:
    on myAwesomeHandler_()
    myTextField's setStringValue_("The new Xcode is so glitchy ugh")
    //changes value of linked text field of parent script
    end myAwesomeHandler_
    The problem is, the variable is undefined in the Loaded script, and I need it to have the same value as the parent script, and I don't want to pass the variable through the Handler. Any ideas?

    I think want you are looking to do will need to be done in two steps. Because myTextField needs to be a property for the ObjectiveC part of the code you cannot turn it into a global.
    However if you make a temporary variable global assign the string to it in the handler then set myTextField off of it.
    global myTextFieldGlobal
    script AppDelegate 
    property myTextField : missing value 
    //linked to a text field object 
    tell myScript to myAwesomeHandler_() 
    myTextField's setStringValue_(myTextFieldGlobal)
    end script 
    on myAwesomeHandler_() 
    set myTextFieldGlobal to "The new Xcode is so glitchy ugh"
    //changes value of linked text field of parent script 
    end myAwesomeHandler_ 
    I know you stated you did not want the handler to return a value but I have to ask why? Global's, imo, are not a good idea and really should be used as a last resort.
    One other possibility is to pass a reference to the property to the handler. Not sure if that works in AS of if that would satisfy our requirement of not passing the variable through the handler
    <edit>
    Another though have you tried to define the property outside the script?  That is
    property myTextField : missing value
    script AppDelegate
    Not sure if that will work.
    You might also want to have a look at Scope of Properties and Variables Declared in a Script Object

  • Problems in syncronyzing two threads into Test Stand using a Global Variable (TestStand 4.1.1)

    I have one thread that is doing TCPIP Aquisition into a Global variable defined in Teststand. And I have another thread that it supose to read it. All are in the same sequence and execution. The problem is that the aquisition thread got a lot of bytes, while the processing thread is reading always only a few. Do you know what the problem could be?
    I will attach also some pictures just to be maybe more clear...
    Attachments:
    Implementation_pictures.zip ‏368 KB

    I wasn't looking at your Sequence, I was looking at Receive_HDL_Block.JPG. What is that VI doing (the one with number 3 on the icon and Size_in_bytes as an input) ?
    Where in teststand are you doing any checking?
    I don't really understand your sequence.
    You have a sequence (running in a new thread) (why), following by another called Receiver Handler (also running in a new thread) then two more sequences which seem to do some with transmitting something (also running as new threads). You are only waiting on one of these threads (the Receiver Handler). There does seem to be any loops in TestStand, you dont seem to be bothered about the other threads that you have running. What happens when this test sequence finally does stop, what is stopping the Threads that you have running.
    Your pictures dont really seem to fit in with your Test Sequence, such as where does Test_005.vi fit into everything
    The whole thing is a bit of a nightmare.
    Maybe your best bet would be to scrap the lot and start again. Only this time have a better understanding of what you what to achieve, what would be best to put into Teststand and what to put into labview. Whether you really need all those new threads running.
    Sorry to be so blunt.
    Regards
    Ray Farmer
    Regards
    Ray Farmer

Maybe you are looking for

  • Any time I open Safari i get a popup for myvdrive? why and how do I stop this? yes my safari preferences are checked that popups should be turned off.

    why and how do I stop this? yes my safari preferences are checked that popups should be turned off. Also it pops up any time that I click anywhere to do anything in safari. Please help.

  • Signing a Midlet

    My midlet connects to a servlet through an Http connection. It works perfectly on the emulator, but when I run it on my mobile phone it throws an IO exception. I was wondering if signing a midlet would solve my problem. If not, what is the benefits o

  • Where are my pictures in Photos after update?

    Hi, after update yosemite my iPhot application is away and Photos is there - but no picture in Photos and only the Photo Library can be open over the Finder (and then if open again) how can I import my picture into Photos?

  • Dreamweaver will not put file to ftp

    I have identified the site in management tools, entered the ftp info, user, password, etc. and tested the connection, which went through successfully. When I edit an html page and upload it does not go through. I'm stumped!

  • Visual Basic 5/Oracle DB

    Hi, I need help to insert a date in a oracle table through VB 5. I am using ODBCDirect, but always I have run time error '3146: ODBC -- Call faild; ORA-00932:inconsistent datatypes. I can do this with text and numeric fields but I can't with date fie