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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why won't this work!?!? Open button works only once...

Solved!
Go to solution

This code is part of a larger project, but presented here are the basics which aren't working in the larger project.

 

I have an Open button and a String entry box. Now, depending on whether you enter a '1' or '2A' into the string, that should activate the case structure in the code and from there an Invoke node opens a specific VI for either of the two string entry choices.

 

As far as I've seen this works the first time, whether I enter 1 or 2A first. But while the program is running the user should be able to enter in the other entry, press open, and again be able to Invoke open the second chosen VI. But that doesn't happen. The Open button just freezes in a TRUE dark grey position and a new String entry can't even be typed into the String Command.

 

Anyway, I've got the program attached here. If you want to run it, in the case statement first put in two new different file paths for the two invoke nodes of each case.

0 Kudos
Message 1 of 5
(2,114 Views)
Solution
Accepted by topic author ShogunOrta

Your Invoke Node to run the VI is set to "Wait Until Done".  Turn on highlight execution and you'll see you your execution is waiting on that node for the subVI  you just opened to finish.

 

You also have a race condition.  Why are you using the local variable of Mode when the terminal is sitting in there unused?  If you start the VI, Mode will be read with whatever value is there when you start.  If change the value in mode, then hit open, it will use the old value.  The Mode terminal and the entire case structure probably belongs in the event case, and wire a False to Wait Until Done.

0 Kudos
Message 2 of 5
(2,107 Views)

Hi.

I think the problem is in the invoke node 'Exec VI' with 'wait till done' on true. I turned in on 'false' and it works.

0 Kudos
Message 3 of 5
(2,099 Views)

Hey! I did everything you suggested and it worked perfectly. Thanks!

0 Kudos
Message 4 of 5
(2,081 Views)

You should still clean up the issue with the local variable.

 

I would also use a ring control or an enum for selecting which to use.  With a free from string control, what happens if someone mistypes the option?

0 Kudos
Message 5 of 5
(2,070 Views)