Showing results for 
Search instead for 
Did you mean: 

How to update MainVI with SubVI information live?

Go to solution

I have a SubVI that updates when it collects data automatically and displays it in a control. How would would I also show this automatic update in the mainVI? Right now my SubVI does all the data and once the test is complete then the mainVI updates with all the information. Does it have to go from mainVI to subVI to work or can I do this from subVI to mainVI?

0 Kudos
Message 1 of 7

You need to pass in references from the MainVI into the SubVI. You can then use those references to update MainVI controls from the SubVI, without the SubVI having to finish execution. 

0 Kudos
Message 2 of 7

So the SubVI can run, and do all the executing of the test, but I have to reference that within the mainVI to update it?

0 Kudos
Message 3 of 7

Hi learner,


learn about notifiers, queues, channel wires, ...

(I think these will work better than references to indicators in your main VI.)

Best regards,

using LV2020 on Win8.1+cRIO
0 Kudos
Message 4 of 7

I wholeheartedly agree with GerdW. Don't use references. This tightly couples your code. Learn how to use queues, network streams aor notifiers for inter-process communications.

Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 5 of 7

You could place a Sub Panel on the MainVI's Front Panel, and pass a VI reference from the SubVI to its property. This way you can display the Front Panel of the SubVI directly on the Front Panel of the MainVI without having to do any extra communication between the two. Just an idea.


EDIT: Added a simple example.

"Good judgment comes from experience; experience comes from bad judgment." Frederick Brooks
Download All
Message 6 of 7
Accepted by topic author LearningLabVIEW

When you are developing in LabVIEW, and have multiple monitors, you can simultaneously view both the Top Level VI's Front Panel (where you "control" the VI by interacting with "Controls" and see the results displayed in "Indicators") and the Front Panel of your sub-VIs where typically much of the real work gets done, including the display of Indicators showing "data processing in progress".


But when you are running your Application, you typically only see the Top Level VI (usually because you only have one Monitor, say on your Laptop).  If you want to "have your cake and eat it, too", and want to (temporarily, or even permanently) view the Front Panel of a sub-VI, you can put a SubPanel (found on the LayOut section) on your Top Level VI Front Panel.  This reserves an area on the Front Panel for viewing (and interacting with) the Front Panel of a sub-VI.  Then you have only to place the Front Panel of your sub-VI into the sub-Panel and then cause the sub-VI to run.


But now you have another question -- what do you want the Top-Level VI to do while the sub-VI is running?  Should it just passively wait for the sub-VI to finish?  Or should it start it, and continue doing other things, letting the sub-VI govern when it stops itself (possibly because the User pushes a "Stop" button on the sub-VI's Front Panel?

Sub-Panel Demo.png


This Snippet shows the first instance.  We get a Static VI Reference to the sub-VI (here called Find DAQ Device), use the sub-Panel's Insert VI Reference Method to display the sub-VI's Front Panel in the sub-Panel, then run the sub-VI.  At this point, the Top Level VI patiently waits for the sub-VI to exit, then can continue processing (and can also do a "Remove VI" to clear the contents of the sub-Panel).  If you want the top-level VI to continue running "doing other things" while the sub-VI is running and letting the User interact with its Front Panel, you can start the sub-VI with "Start Asynchronous Call".


This is a slightly advanced technique.  I didn't learn about (or start using) sub-Panels until I'd been using LabVIEW for about 4-5 years (but I may be a little "slow" ...).


Bob Schor

0 Kudos
Message 7 of 7