LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

get a variable from top level VI to a SubVI

hi
 
I have a question i am looking for a way to get a file locatio thats , defined in the top level VI to a SubVI thats a part of another SubVI under the top level VI. I want to do this without using terminals because of wiring problems ( wiring true 3 VI levels). Is there an other way to do this?
 
Thnx
Bart Bakels
Labview CLD , Engineer/Manager

Promedes and DSM
using LV 7.1, 8.0, 8.2, 8.5 and 2009 SP1
http://www.promedes.nl
0 Kudos
Message 1 of 3
(2,438 Views)
Hello Bart,

use wiring, it's the natural way of LabView to get data from point A to B...

Other methods may be: using a global variable, using a reference (which may need wiring or a global too...), using a temporary file (perhaps an ini-file). And there are sure some other methods as well...


Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(2,430 Views)
If your division into subVIs is based on functionality, then using a wire is usually the best way to go.
If, for whatever reason, you don't want this, you do have several other options:
  1. Bundle the data you're passing into clusters. This will result in a single terminal, but you will have to bundle\unbundle the cluster to get to the data.
  2. Use global variables. These can be dangerous if not used correctly, because they can cause race conditions. Search the example finder for examples of how to use globals.
  3. Use functional globals. These have some advantages over globals, mainly in preventing race conditions and memory-wise. Search this site for functional or LV2 style globals for some more details.
  4. Use control references. This is probably the least convenient way and most dangerous way, and you should not use it unless you have a good reason.

In your case, it seems that option 2 is the best one, but you should be careful about it. Once again, if the VI is designed well, then a wire is the way to go. Try reading the LabVIEW style guide for some more details.


___________________
Try to take over the world!
0 Kudos
Message 3 of 3
(2,422 Views)