From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What is good code structure when I need continuous data from popup VI?

Hello,
 
This might be very easy question but I have spent few days to solve it. I have a main VI which need some data from popup VI. When user change parameters in popup VI this information must be updated immediately in popup VI and main VI. I tested use event structure but the values were updated only when user close popup. I can't integrate popup VI to main VI because there is no space anymore.    
0 Kudos
Message 1 of 6
(2,479 Views)
If you want to receive data from a pop-up subVi you have to start the subVI with an Invoke Node, method = Run VI (wait unitil done = false) , then you can read the subVI:s controls with another invoke node, method = Control value Get [Variant or flattened] in a loop in the main vi.
On the other hand, if the reason is "no place in the main vi" I think you should consider a re-construction of the main vi, for example use SubVI:s on "other places" where you can use "normal" data flow between main- and sub-vi.
 
Regards
Sture
0 Kudos
Message 2 of 6
(2,475 Views)
If the popup is a parallel VI without data dependency to the Main VI, you can use queues or Action Engines to pass the data. If you do not want the popup to always be visible, the Main VI could send commands via another queue to tell popup when to show its panel.

As Sture said, reconsideration of the architecture might be worthwhile. We would need to know more about what the two VIs are doing and how the users will be responding to give good recommendations.

Lynn
Message 3 of 6
(2,442 Views)

I have to seconds Lynn's recomendation for an Action Engine.

I'd think twice about using the control reference technique since managing the control references could become cumbersome and it opens us up to race conditions.

Ben

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 6
(2,426 Views)
Hi all,
 
Your tips solve my problem. I made a small example program. I didn't get a point why I have to use Control value Get method, because this example work ok.
 
 
Thanks !
0 Kudos
Message 5 of 6
(2,400 Views)

sorry, I was in a hurry.

What I ment was, you have to start your popup-vi with an Invoke node (otherwise, if you have 1 loop in the main vi, your main vi vill "hang" while waiting for the popup to return). Then I said you "can get the values with an Invoke node" . There are many other posibilities, mentioned in answers above, which I think are better.

/Sture

0 Kudos
Message 6 of 6
(2,391 Views)