From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
09-23-2021 02:35 PM
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.
09-23-2021 02:40 PM - edited 09-23-2021 02:41 PM
09-23-2021 02:49 PM
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?
09-23-2021 03:25 PM
09-23-2021 04:27 PM
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.
09-24-2021 09:17 AM - edited 09-24-2021 09:50 AM
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.
09-24-2021 11:21 AM
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" ...).
Bob Schor