Control global variable used in sub vi

Hi,
I've created a vi to read an instrument and to initiate its calibration with labview. This VI stores data in a global variable containing measurments and status of the instrument.
Now what I'm trying to do is create a sub vi with this to read&write 2 exactly identical instruments so I can finally create a VI that read all 3 instruments simultaneously.
How could I create a control on the global variable used by the sub VIs since it is the only thing that will change along with its COM port ?
I included a screetshot of the current VI.
Thanks,
Attachments:
Read_Calibrate.PNG ‏61 KB

I would make an array of values and then you just pass in which value to update.  I would actually take it a step further and make an Action Engine that can update the data and return the data.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines

Similar Messages

  • How to declare global variables using another global variable in ODI

    I am declaring a gloabal variable using another global variable.
    say for example:
    I have a global variable empid.
    I am decalaring another global variable empname in refreshing tab of global variables and the select statment is
    select empname from emp where empno = #GLOBAL.empid -------if i write like this i am getting error as invalid character.
    select empname from emp where empno = '#GLOBAL.empid'-------if i write like this i am getting error as invalid number.
    I have kept the datatype as numeric and action as non persistent
    Please help
    Thank you in advance.

    Hi,
    You cant test/refresh empname standalone.
    You need to create a new package drag and drop both variables and make them as refresh variable and execute that package and test.
    Flow,
    empid----> empname
    Thanks,
    Guru

  • Using global variable read status

    Hi Experts,
    I need to change the Note based o the Service Ticket status. I declared global variable as a string in ZL_ICCMP_BT_BTSHEADER_IMPL (Component: ICCMP_BTSHEAD; View: BTSHeader)
    And I am passing the Status to this global variable using the GET and SET methods of the STRUCT.ACT_STATUS attribute in BTSTATUSH node in same component and view.
    I referred this global variable in DO_PREPARE_OUTPUT of the component ICCMP_BTTEXT/TextView to set the Note as shown below.
    if ZL_ICCMP_BT_BTSHEADER_IMPL=>GC_STATUS = 'E0001'.
    I would like to know whether this approach is the best way to read status or any other optimistic  approach is there to follow for my this scenario. Please advise me.
    Thanks
    Chand

    Hi Basha,
    If you are using static variables, i wouldn't recommend using this approach.. there are better approach to get/set values in web client session which avoids setting/clearing static variables etc..
    you can follow below approach..
    1. To Get/set the variable in ic session to avoid the static variable.. for eg global cuco is available which you can use for this purpose.
    lr_bdc type ref to if_crm_ui_data_context.
    lr_bdc = cl_crm_ui_data_context_srv=>get_instance( me ).
    check lr_bdc is bound.
    Using SET_DATA_ATTRIBUTE set the attribute value and using GET_DATA_ATTRIBUTE get the attribute valueu2026get_attribute, set_attribute
    read current BuAg if exist
    lr_buag ?= lr_bdc->GET_DATA_ATTRIBUTE( 'CURRENTBUAG' ).
    Here "CURRENTBUAG" is the attribute name, you can give any attribute name while setting and get the same attribute value via get_data_attribute.
    Cheers,
    Sumit Mittal

  • Global variable corruption

    hi
    im using labview 6.1.
    i have a frame in a sub-vi that that reads 16 bytes from com7 (in my pc) into a global variable using a custom DLL. this variable is then used later to compare some data in another sub-vi.
    this was working fine for a day, then this morning i started it again and ran it. when i got to the point where this "read" happens i got a dr watson exception message. (i am running the application on nt4 in the development environment). after this point the gloabal had rubbish in it whenever i did a read, although it did also hold the basic read data. after a reboot etc it still did it. the fix was to completely remove this global from the application vi and my file globals.vi , create a new one and then use that in the same manner.
    everything was ok for an hour.
    then the same thing happened again.
    any ideas? this is really annoying.

    It sounds like you're DLL is corrupting LabVIEW's memory. This doesn't necessarily mean you're DLL is doing anything wrong. It just means you have to be careful when calling external code in LabVIEW to make sure that it plays nice and doesn't stomp on LabVIEW's internal memory.
    If you expect your DLL to output a 16-character buffer on every call, then you should be passing in a dummy string into the buffer input for your Call Library Function Node of at least 16 characters in length. This will help LabVIEW allocate the data correctly and pass it into the DLL to operate on. The DLL should not resize this buffer, because LabVIEW won't be notified.
    Are you doing anything along these lines?
    Message Edited by Jarrod S. on 03-01-2007 03:06 PM
    Jarrod S.
    National Instruments
    Attachments:
    allocate_string_dll.PNG ‏18 KB

  • Any way to set global variables except EAS console?

    Hi pros,
    I am searching for a way to set global variables (used by business rules) automatically.
    I got several variables which should change each month. I know the rule to set them.
    However, I cannot find any way to set them through scripting or something else.
    I tried to research EAS repository. The one that I found relevant is HBRVariables table.
    I cannot find any tool can help this.
    Any one knows how?
    Appreciated......
    Casp Huang

    Yes you can use substitution variables in business rules and they are widely used, it is relatively easy to automate the changing of values for subtitution values.
    You can also put a sub var into the default value for a global variable in business rules.
    Cheers
    John
    http://john-goodwin.blogspot.com/

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

  • Forms personalization and global variable

    Hi,
    I'm trying to call a procedure in forms personalization and using a defined global variable. The data in the global variable is number. In the procedure, some of the parameter has a number datatype and I'm converting the global variable using to_number eg (to_number(:global.XX_LINE_NUM). This fails with error message ora-01403 no data found. I've tried putting the above into a variable with datatype number in the declare statement, and it errors as well.
    Does anyone knows the syntax to convert the global variable to number datatype in personalization.
    Thanks

    Ask in this forum : OA Framework

  • How to Set multiple Global Variables without using Controls or Indicators

    I have to set many Global Variables (i.e. declare and initialize them) in a subVI in order to pass them to various other subVI's. The only way I know how to do it in LabView is to create a Globals.vi on which you create a control or indicator for EACH Global Variable. That's fine if you have only a few variables. But I have close to a hundred Global Variables (which come from a configuration file for a large program) and clearly it is impractical and cumbersome to create a control for each global variable. In Agilent Vee, there is a simple function called "Set Variable" that sets the data value of a global variable. Then in other module, you simply use the "Get Variable" function to get back the v
    ariable and its value.
    In LabView you can use the "Invoke Node / Set Control Value" and "Get Control Value" properties to achieve the same thing. But as mentioned above, you need to create a control for each global variable and that is a big pain in my case, with many global variables. Furthermore, the global variables are read from a Configuration Text File to this VI. Is there a way to do it without using the control? Thank you in advance for any help.

    Actually you could create the same sort of facility in LV. All you have to do is create a LV2-style global that behaves as follows:
    To write a value to it, you supply a value name and the value. These pieces of data are save internally in seperate arrays.
    To read a value, you supply a value name. The VI looks up this name in the value name array to return an index into the value array. Output the value you find.
    Frankly though, it sounds like what you really need is not hundreds of globals, but a good way to manage configuration data.
    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

  • Is it possible to use a variable to control the path where a sub-flow is found ?

    I have a customer on UCCX 7.0.2 SR5.
    They are developing a script that uses many sub-flows and they wish to have a "Development" , "QA" and a "Production" versions of the application all on the same box.
    I can build the applications easily enough but the challenge I'm running into is we want to also have 3 different sub-directories in the repository to hold the different versions of the scripts and the sub-flows.  The thought is the developers can keep working on modifying the code while the QA team tests the latest build without affecting each other.  Then there is a separate production version of the script that has previously passed QA and is public facing.
    Example: the directory structure where the scripts are stored.
    \root of repository
         App-Dev
         App-QA
         App-Production
    In a script, it seems that you have to browse to the location in the repository and directly select the subflow you want.
    This is a challenge since when I copy my code from the development to the quality assurance directory I have to go thru and edit all the references to the sub-flow to the QA directory.
    Ideally I'd like to do the following:
    Define a string variable "Script-Path" and assign it to the desired directory
    then call the subflow
    SCRIPT[Script-Path\ScriptName.aef]
    this doens't seem to work.
    Has anyone found a solution to this challenge ?
    Thanks

    Hi,
    Does the subflow script and the script that calls it are in the same folder??
    If the script was originally loaded from disk, the subflow script must reside in the
    same folder as the script that calls it. If the script was loaded from the Repository,
    then the subflow must also reside in the Repository.
    EDIT: My first comment was because I though you were trying to call a script directly from disk.
    Now for scripts that are in the repository I did some tests. I have the root directory where I placed the main script and then I have another directory called Test where I placed the subflow script.
    My main script is:
    Start
    Accept
    PlayPrompt (audio.wav)
    Subflow(subflowVariable)
    End
    *subflowVariable is a parameter with value "Test\subflowScript.aef"
    My subflow script plays a prompt.
    So when I test this everything worked just fine
    Gabriel

  • What is the difference between using a global variable,passing a valuee and using a reference?

    I have created a project that consists of several VIs.  Only the main VI has a front panel and the others perform functions.  The function VIs are dependent on controls on the main VI's front panel.  I have several ways of passing the value of the controls.  One is to use a global variable and just place it on the dependent VIs.  Another option is to strictly connect the terminal from the control to a VI connector block and pass the value directly.  My last option is to create a reference of the control and reference it inside the dependent VIs, but this would also require connections to be made to the VI block.
    What are the advantages/disadvantages of these options?
    -Stephen

    5thGen wrote:
    I have created a project that consists of several VIs.  Only the main VI has a front panel and the others perform functions.  The function VIs are dependent on controls on the main VI's front panel.  I have several ways of passing the value of the controls. 
    1) One is to use a global variable and just place it on the dependent VIs.
    2) Another option is to strictly connect the terminal from the control to a VI connector block and pass the value directly. 
    3) My last option is to create a reference of the control and reference it inside the dependent VIs, but this would also require connections to be made to the VI block.
    What are the advantages/disadvantages of these options?
    -Stephen
    1) Globals are evil and introduce race conditions.
    2) The sub-VI only get the value when it was called and updates that occur while the sub-VI is runing are not sensed by the sub-VI
    3) This uses property node "value" or "value signaling" both of which run the user interface thread which is single-threaded and you incur a thread swap hit to performance. You also have a potential for race conditions.
    The are various methods for sharing dat to/from sub-VI which include Queues and Action Engines.
    I hope that hleps,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • 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

  • What are the best practices to use GLOBAL Variables

    Hi,
    Please guide how Global Variables can be declared and how they can be initialized.
    Further please guide what are the impacts of Global Variables(if any) on the memory of CLIENT or SERVER, if they are not initialized or freed up after usage.
    Thanks.
    Regards.

    spilgrim wrote:
    My preference is not to use them and to use parameters or package variables. There is not real control on globals so you can end up with an applicatios that has lots of them that are only used once but persist for the user session.I second that. I don't know how often I searched for bugs caused by typos in the names of global variables. Plus the fact that they are only of datatype VARCHAR2. If you are using share_library_data you could also use Package globals in a forms library to share data between called and calling forms. Or you could use a database package...
    cheers

  • Using functional global variables to transfer data between touch screen device and other targets

    Hi,
    We are currently developing a control system that will operate on a cRIO with a touch screen interface. During development we have been using functional global variables (FGVs) to handle most of the settings/data etc, however we have just realised that we may have an issue updating the data on the touch screen, and vice versa.
    Previously we have implemented similar programs using shared variables, however we were wondering if there is anyway to implement FGVs in a similar manner, whether it'd be a combination of FGVs and shared variables.
    Regards,
    Mike
    Software version: Labview 8.2.1

    See this thread on LAVA about sharing FGV's across projects. THis should be extendable to cross paltforms (I believe).
    You also may want to concider an upgrade to LV 8.5.1. We have found a number of performance related issues with LV 8.2.1 and RT.
    If you decide not to upgrade, just remeber what I wrote (above) when you have reason to question the performance.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Can I use the timestamp of a Network published global variable to reduce network traffic?

    I would like to use a couple of network-published global variables that will contain large clusters of data.  I want to host them on one device but read them from several - consider a distributed control system.  The data will update very infrequently, but, when it does, I want all my HMIs to know quickly.  I can have all the HMIs just read the data 4x/second (that would be fast enough) but I was wondering if there is a more elegant solution (still using global variables).  If I read only the timestamp 4x/second from each of the HMIs, compare it to the last read, and then poll the whole variable only if the timestamps are different, will that require less resources than just grabbing the whole variable every time?  In other words, does reading the timestamp use the same amount of resources as reading the whole variable?
    With really simple code, assuming the "Setup Data" cluster is quite large, does....
    ...get me any advantage over...
    Solved!
    Go to Solution.

    mark3545 wrote:
    So that means they are already doing what I want anyway, right?  If the reader only gets updated when the writer changes it, I can poll it as often as I want without increasing traffic, correct?
    That is correct.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Word 2010 VBA - Global Variables in VBA and using them in VBA Code

    Hiya
    I need some help.  I have the following code that takes a word document, converts it to pdf and saves it to the local temp folder and attaches it to an email.  Up until now the filename for the file has been hard coded.
    I have now created a userform that allows the user to enter a filename for the document and I have created a global variable for the filename to be stored.
    What I want to be able to do is pick up this filename from the global variable and add it to filepath in the code.  At the moment it just saves the document as Mytitle which is what the variable is called.
    Here is my code, can I please have some help as I am a little lost, this is the first time I have created something so complicated!!
    Public Mytitle As String
    Private Sub CommandButton1_Click()
    ConvertandSave
    Createemailandattach
    End Sub
    Sub ConvertandSave()
    'converts to pdf and save locally using filename from userform
    ActiveDocument.ExportAsFixedFormat OutputFileName:="C:\temp\Mytitle.pdf", _
    ExportFormat:=wdExportFormatPDF, OpenAfterExport:=True, OptimizeFor:= _
    wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1, To:=1, _
    Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
    CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
    BitmapMissingFonts:=True, UseISO19005_1:=False
    End Sub
    Sub Createemailandattach()
    'creates email and attaches to the file
    Dim oOutlookApp As Outlook.Application
    Dim oItem As Outlook.Mailitem
    Dim MyFileName As String
    On Error GoTo SendCancelled
    MyFileName = "c:\temp\Mytitle.pdf"
    Set oOutlookApp = GetObject(, "Outlook.Application")
    If Err <> 0 Then
        Set oOutlookApp = CreateObject("Outlook.Application")
    End If
    Set oItem = oOutlookApp.CreateItem(ofMailitem)
    Set objRecip = oItem.Recipients.Add("   email address goes in here")
    obj.Type = olTo
    oItem.Display
    'oItem.Subject = "My Profile - "& UCase(LastName) & " " & FirstName
    oItem.Attachments.Add (MyFileName)
    Exit Sub
    SendCancelled
        MsgBox "This macro was cancelled"
    End Sub
    Any help here would be very much appreciated

    Assuming that you have other code to set the value of Mytitle: change all instances of "c:\temp\Mytitle.pdf" to
    "c:\temp\" & Mytitle & ".pdf"
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

Maybe you are looking for

  • Formatting img file outcomes

    I am using Robohelp 7 HTML (Webhelp primary layout) to create a context sensitive help system. When the context sensitive help opens it does so in one panel only so I need the "Home" link to open the complete help system in the twin panels. I have ed

  • Avoiding DUMMY value for profit center while posting COPA document

    Hi All, I have a requirement where I post a document using BAPI_COPAACTUALS_POSTCOSTDATA using a Z Program. Everything works fine , but if we do not mention the profit center explicitly, it takes the value as "DUMMY". Same happens with KE21N. I want

  • How do I recover my browser history that was deleted today?

    I accidentally deleted all of my internet history, and there were sites on there I needed to bookmark for a school research paper. How do I recover the history? I only need the history from today.

  • UCCE Custom Routing Using Queue To Agent

    I have a customer interested in performing their own agent selection using a database lookup rather than selecting agents based upon skill group assignment. The suggestion has been made to perform the database lookup and use the queue to agent node.

  • Ot: adobe premiere export for youtube

    Hello, I know this is off topic but thought i would ask the question any way as no one really replies to the adobe premiere forums. any way my question is this I have a digital video camera which shoots at 16:9 format what would I be best exporting i