How can I programmatically create and use a global variable?

I have an app where the number of AI DAQmx tasks I create are specified in a config file.  I have a monitor task that periodically looks at the latest values from all DAQ tasks.  I've been doing this with a set of global variables because it was the simplest way to do it.  But to do this, I have to explicitly create a separate AI task that uses the hard-coded global variable name for the DAQmx samples.  I would prefer to only write one VI for the DAQ loop that writes to a global variable that I programmatically create based on the config file.  The only solution I can think of is to use a global variable "pool" that is sized bigger than I expect to need, and then have a big switch case to select which one I want based on the task index.  But this sounds pretty silly.

I tend to agree with Ben. I don't buy the concept of taking the asy way out (globals) because it very rarely will things remain static. You almost always have to extend the features and functionality of an application and then you will run into issues with sloppy and lazy implementations. The solutions offered may require a little time to learn but once you do it doesn't really require any extra effort.
Mark Yedinak
"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot

Similar Messages

  • When printing in Excel It is always want to use the acrobat X pro trial, which the trial is expired. I do not want to use acrobat X pro trial anymore. How can I reset it and use simple acrobat to print my PDF document?

    When printing in Excel It is always want to use the acrobat X pro trial, which the trial is expired. I do not want to use acrobat X pro trial anymore. How can I reset it and use simple acrobat to print my PDF document?

    Hi screen name,
    Adobe PDF printer gets installed when you install Acrobat 10 Pro.
    To use this printer you need to purchase Acrobat. Once the trial period is over you cannot use the printer to create pdf files.
    An alternative way for you is to utilize Microsoft's own inbuilt pdf engine.
    You can simply open the file and select 'Save as' and in the type list select 'pdf'
    Please refer : http://office.microsoft.com/en-in/excel-help/save-as-pdf-HA010354239.aspx
    Regards,
    Rave

  • I have two Apple ID, how can I delete one and use the email address associates to the main one?

    I have two Apple ID, how can I delete one and use the email address associates to the main one?

    If you abandon one of the Apple IDs you will also basically be abandoning any content that you have acquired with that Apple ID. Content can only be updated and re-downloaded with the Apple ID that was used to buy it. Apple will not combine the content of Apple IDs and Apple will not transfer the content from one Apple ID to another Apple ID.

  • How to Set and Use a global variable within a session?

    Dear All,
    I'm new to jsp, and would like to ask how to set and use a global variable within a session?
    Thanks in advance.
    Regards,
    Cecil

    With session.setAttribute("name",object) you can store a Attribute in the session object.
    with session.getAttribute("name") you can get it.
    That's it.
    Regards,
    Geri

  • How do i create and pass a global variable from one vi to several sub-vi's?

    Hi Guys,
    I am trying to create a program that opens several front panels (sub-VI's) in sequence. in each front panel, the user would open a file that the name is obtained from the previous sub-VI. I would like to know how i could pass the filename and refnum of the file thorough from one sub-vi to another. A global variable would do it in VB, but how do we do global vars in LABWIEW. thanks
    Papish

    I put together a sample VI and Sub VI that illustrates how to pass a Refnum and access a data file while in a Sub VI.
    For multiple VIs just repeat the sub VI process.
    You probably don't wanna use a Global Variable if not needed (can add to the mess down the road haha).
    Let me know if it helps you out! Or if I can clarify anything else!
    Chances are if you have seen VI in the forest it hasn't fallen.
    Attachments:
    Passing Refnum.zip ‏21 KB

  • How do I programmatically create and save an empty project?

    I can programmatically create an empty project, but when I drop an
    invoke node on the project, select "Save", and wire in the desired
    path, it results in an "Error 1".  I am getting the error on the "Save"
    invoke node (An input parameter is invalid.)  The only input is the
    path, which is correct.  What am I doing wrong?  Also, how can I
    specify a name for the project?
    Greg

    I think the problem is that you use the current path and strip off the path the current VI's name.  This leaves you with a path that has no filename to save it to.  Put in a build path after it where you build in a project name with a .lvproj extension.  When I did that, the error went away.
    Message Edited by Ravens Fan on 08-08-2007 11:36 PM
    Attachments:
    Create%20and%20Save%20New%20Project[1].png ‏4 KB

  • How can I obtain a reference to a global variable?

    I wish to change the contents of the columns in a global multicolumn listbox. As far as I can see, the only way to access the columns in a multicolumn listbox is to create a reference to it and access the ItemNames property. But how can I create a reference to a to a global variable?

    You can open a reference to a global as if it is a normal VI and then get a reference to a control on that VI. I have included a little VI here with a test global variable to get the item names from an MCL in that global. I needed the MCL in the main program just to force the reference to a strict MCL reference. You could turn this into a sub VI that just returns the item names of a named MCL if that works better (then the MCL that's only used for reference would not be on your main front panel).
    This VI searches through all the names of the controls on the referenced VI until it finds the one that's asked for.
    Have fun with it.
    Rob
    Attachments:
    Get_Ref_to_MCL_in_Global.zip ‏158 KB

  • How can I do the CNiReal64Vector as a global variable?

    My problem is with the CNiReal64Vector. Ive tried to define this vector as a global variable in the header file:
    public:
    NI::CNiReal64Vector plotData(50);
    but the debuger flushed error : Syntax error ´constant´.
    Of course,  I used usually square brackets:
     public:
    double plotData[50];
    Is it possible define the array of CNiReal64Vector as a global variable?
    Thank You.
    Best Regards
    Emta

    In the header (.h) file, declare the variable like this:
    extern NI::CNiReal64Vector plotData;
    In a source (.cpp) file, define the variable like this:
    NI::CNiReal64Vector plotData(50);
    This will cause the compiler to generate a single instance of the plotData global variable and a call to the CNiReal64Vector constructor that takes an integer that specifies the initial size. I believe that this is what you are trying to do.

  • How can you share Contacts and use Family Sharing?

    Still sharing 1apple ID & 1 iCloud from way back when.  Kids were little, syncing was simple... turned off their device iClouds and synced apps, playlist, shows w/ iMac via usb.  I loved having my contacts, bookmarks, notes synced via iCloud and it became VERY handy when kid1 got an iPhone (appointments, practices, friends #s w/ ease!)   We've recently added a macbook and another iPhone to the mix, we've got music issues & iPads ringing.... so a potential overall may be due?
    Now that Family Sharing is here, it's still missing features that we USE:
    * Notes (grocery list, packing lists...)
    * Contacts (each family member has a 'group' name, they add to their group and the family's master list is 'all contacts' for anyone to access incase of emergencies.... anyone keeping up w/ kids lately?!)
    * And the ever present iCloud icon is a looming feature for anyone, any age in the shared-family to be too curious...
    * CAN any of these features be added along w/ Family Sharing?
    HOW do I set up a simple family sharing system w/o interfering w/ bookmarks, personal notes, FaceTime/msg crossovers :
    share our purchases (apps, music from our iTunes/playlists, podcast),
    share our calendar
    share our contacts
    share a family notes
    msgs/facetime for each member
    mom: iphone, ipad, imac
    dad:  iphone
    kid1: iphone, macbook
    kid2: ipad
    kid3: ipad
    Thanks to anyone that has this set up and will share the method to my madness.  Didn't know where to post this, sorry about that.

    After having burned the AudioCD from iTunes Menu Advanced choose "Submit Track Names ..."
    That will put the data of your CD into CDDB.
    It may take between some hour and a few days until it is recognized on a second computer through CDDB.

  • How can I disable iPhoto and use my iPhone / iPad as in Windows?

    I really despise iPhoto and I would like to use my iPhone / iPad just like in Windows where I can drag and drop the photos and videos from my iPhone or iPad as if it's an external hard drive in windows.  iPhoto is the only thing I really truly hate about OSX. 
    Thanks.

    If I understand what you want, maybe these two programs can help:
    Transfer items from IOS device - DiskAid
    Transfer items from IOS device - Touchcopy

  • Data Modeller: how to create and use collection type

    Hello,
    basically subj. I'm not clear how to ( for example ) create and use the data type based off the varray data type.
    Please advise.
    thank you
    andrew

    Hi Andrew,
    you can create collection types (varray/table) in two ways:
    1) in browser - find "Data Types">"Collection types" node use pop-up menu - it's just "create new collection type" there
    2) in Data types model diagram - you can create collection of "certain structured type" or collection of references to it - use "new Collection ..." tool and first click on referred structured type and after that on structured type that will hold the collection - new attribute is added in latter type and if there is no such collection type already defined new collection type is created and you can edit it later.
    Philip

  • How can I programmat​ically detect transition times in a digital waveform

    Hi, I have a digital waveform and at certain times I have transistions and glinches , how can I programmatically detect and record the time stamps of the transitions
    Thanks  

    Let me see if I understand you. You are reading 14 bits in parallel and you want to know how long between transitions of just one of those bits - say bit 11. Is this bit number constant or can the number of the bit in which you are interested change?
    Well, you could XOR the value from each read of the digital bits with the 14 bits you got from the previous read. If the resulting value of bit 11 is true, the state of bit 11 has changed. Use that flag to read/restart an interval timer. Of course the resolution of your measurement will be dependent upon the rate at which you are reading the 14 bit input. If you are only sampling the 14 bits every 500 msec, you obviously won't be able to measure intervals of less than 1/2 sec.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • I have an ipad mini. From one moment to another a document that was created and used on pages app ( on the ipad mini) does not want to open ( When pressed it states " document cant be opened). How can I make this document open again?

    I have an ipad mini. From one moment to another a document that was created and used on pages app ( on the ipad mini) does not want to open ( When pressed it states " document cant be opened). How can I make this document open again?
    I have tried back ups and  restoring, resetting, and even updating the pages app. And nothing has worked.

    I have an ipad mini. From one moment to another a document that was created and used on pages app ( on the ipad mini) does not want to open ( When pressed it states " document cant be opened). How can I make this document open again?
    I have tried back ups and  restoring, resetting, and even updating the pages app. And nothing has worked.

  • I had my Itunes account disabled due to fraud, if i create a new itunes account how can i switch purchases and apps to the new ID?

    i had my Itunes account disabled due to fraud, if i create a new itunes account how can i switch purchases and apps to the new ID?

    Hi ...
    Just be cause the account was disabled (Apple ID) doesn't mean you can't reset the password and have access to your iTunes purchases.
    Use the iforgot link to reset your password > Apple ID: "This Apple ID has been disabled for security reasons" alert appears
    If you have problems resetting, use the email form here >   Apple - Support - iTunes Store - Contact Us
    edited by:  cs

  • How to create and use dynamic queue in JMS

    Plz tell me how to create and use a dynamic queue in jms and can reciever file lookup it as it lookup any server configurred queue(written in the server).

    Hi,
    We can use Azure File services to do this, for more information, please have a look at this article:
    http://blogs.msdn.com/b/windowsazurestorage/archive/2014/05/12/introducing-microsoft-azure-file-service.aspx. The Azure File service exposes file shares using the standard SMB 2.1 protocol. Applications running in Azure can now easily share files between
    VMs using standard and familiar file system APIs like ReadFile and WriteFile.
    Best Regards,
    Jambor
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • "iPod cannot be synced. A duplicate file name was specified"

    I get this error: And then end up with this screen: I have my iPod manually managed, none of my music is actually organized into an iTunes folder or anything, my iPod is NOT automatically synced with iTunes. I do automatically sync photos to my iPod

  • Steps to migrate SQL Database to Windows/Oracle

    hi We have an SQL database in our client network and client wants to migrate it to Windows/Oracle. Currently they have multiple databases on the same SQL server. So I am curious to know if oracle also allows the same in Windows. I read that we can in

  • Audio data not loading with certain clips. Premiere Pro CC 2014, using .mts files

    When I open a project, sometimes a clip will not load its audio data. In the photo I've attached, you can see the video clip on the right has the waveforms showing up, but not for the clip on the left. Rendering does nothing, I've tried clearing Prem

  • ITunes Purchased Playlist missing tunes

    Hi, The purchased playlist in Itunes is missing a few tunes. They are in my Library, just not in my purchased playlist. On the purchased menu on my Apple TV all of the items that I have purchsed are there. How can I get the purchased playlist in Itun

  • QuickTime ActiveX Control won't install

    I just downloaded and installed the newest version of QuickTime (QuickTime 7.6 with iTunes for Windows XP or Vista). Using Internet Explorer, I then tried to open a link to a web page that has a QuickTime video file. I get the information bar message