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?
Solved! Go to Solution.
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?
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.
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.
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?
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" ...).