Showing results for 
Search instead for 
Did you mean: 

Get the actual value of a variable into a running VIsub, when called from a main VI

Hi, I'am developing an application where several sub-VIs are called and takes a lot of time to finish the process.

I would like, in the main VI, to insert a progress bar that should evoluate by getting some variables (counters) in the called sub VIs.


The problem is that if I select the counter in the subVI as an output, I can only get the fina value after the execution.


What should I do? thanks.

0 Kudos
Message 1 of 3

Hi Mar1,

                   If you have connected any variable for example say VISA read then it will be updated after completion of read  function. Hence you cant use progress bar in that case.


One solution is, If you know the total time elapased by called SubVI then create one parallel while loop in which progress bar will increment for expected time duration. What i mean to say is if each of your subVI takes 30 sec to complete then create one additional while loop in subVI only. Inside that while loop one progress bar which will start incrementing same time subVI is loaded and will reach 100 after 30 sec.  

Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
0 Kudos
Message 2 of 3



place counters in the sub vis for each position. Or use a progress bar control in each sub vi. Then,


Use VI Server. In the Main vi, get the reference of your subvis, using Static VI Reference and use Invoke node to get the Control Values. Put this in a loop with a delay of about 100ms and you can read your sub vi control values.


Another way is to use Functional Globals in each sub vi. Write into the FG in the sub vi, Read from the FG in the main vi.


Or, just pass the control reference of the required controls inside the sub vis to the main vi using a FG, and use property node with each reference to read the value.


Study more on property nodes, invoke nodes, VI Server and Functional Globals. There is lots of info on this forum about those topics

TestAutomation Consultant
0 Kudos
Message 3 of 3