04-11-2020 12:12 PM
Hello,
When the user presses a button in the front panel, I want it to close the existing VI and open another VI.
What I did is presented in the attached picture :
The problem is that sometimes it closes the existing VI and not opening the other VI.
I've done this exact thing in other VIs without any issue, which leads me to think if this is a problem related to the VI properties maybe?
Note: If I put this code in sequence (Open other vi then close this VI), it only opens the other VI and not closing the existing one (because the other VI has a loop?)
Thank you.
Solved! Go to Solution.
04-11-2020 12:25 PM
There are several reasons why this is not a good way to do this, but I'll address the Fundamental Problem -- do you know the Principle of Data Flow, the "central idea" that governs how LabVIEW executes its routines? [I'm guessing the answer is "No"].
Look at your Block Diagram. Which will be executed first?
Did you choose #1?
Bob Schor
04-11-2020 12:39 PM
I think the answer is 3 because they are running in parallel .
But then again, I never had a problem with the exact same code, which is weird.
04-11-2020 12:57 PM
Search the help for Asynchronous Call and Forget. Basically you call a VI and don't worry about retrieving its response. Do that, then close your calling VI. Should work.
mcduff
04-11-2020 01:17 PM
Is the calling VI the toplevel VI?
04-11-2020 01:23 PM
Yes, #3 is correct, and you seem to have fallen afoul of it. Does Unnamed VI use the Error Line, i.e. is there an Error Out on its lower-right corner? [There should be!]. Drag that Error to the Error In of the Invoke node and Data Flow will ensure that they work in the "expected" (and desired) order.
Bob Schor
04-11-2020 01:27 PM
Yes it is the toplevel VI.
04-11-2020 01:35 PM - edited 04-11-2020 02:32 PM
Hi Bob,
I'm sorry I don't see an error out on the Unnamed VI (the one with the 2) . It doesn't have any inputs or outputs.
Edit : I created an "error out" indicator in the Unnamed VI as the output of the VI and connected it as instructed, the main vi doesn't close.
04-11-2020 01:42 PM
@BG1995 wrote:
Yes it is the toplevel VI.
I thought if the toplevel closes, all dependecies will stop executing too. (Not 100% sure). For workarounds search for "splash screen" implementations.
04-11-2020 01:54 PM
I have the option "Close afterwards if originally closed" turned off.
Also It doesn't close the existing VI and not opening the other VI all the time, only sometimes.