Showing results for 
Search instead for 
Did you mean: 

How can I stop the inner while loop when the outer while loop stops

How can I stop an inner while loop when outer reaches its condition?

I wanted to use read local variables, but I dont think its a good way 😕

Can u give me an example.

If I want to use a template which one should i use?

0 Kudos
Message 1 of 13

I am not sure how that would work as the execution would be in the inner loop and your outer loop wont work when this is happening.


This post has some links which may be of interest if you have seperate while loops.

CLA CTAChampion
Subscribe to our Test Automation user group: UK Test Automation Group
0 Kudos
Message 2 of 13

do you have a while loop inside another while loop ?

if this is so you can not stop outer while loop unless inner has finished.

Message 3 of 13



You can have two independent while loops to perform your operations. and then you can stop the other if any one of it stops.

0 Kudos
Message 4 of 13

Please post the VI so we will understand the problem.

At this moment, if you have a loop inside another while loop, because of the data flow, you should stop first the inside loop and after that take decision to stop the outside loop.



Kind regards,


Ion R.

0 Kudos
Message 5 of 13

hello all, I wanted the thermo couple to read in || with the rest of the sensors. I placed it now inside each sequence.

Today I had a presentation and a demo. It gone bad. 😕

We didnt try the vi and there was as error with the stop.

I think its the NI elvis that we used.

Can you guys fix the code. 

0 Kudos
Message 6 of 13

Fix it?!?  I can't even see it!  Your IMAQ VI need an IMAX Theatre sized screen to view it. 


You need to re-think your top-level structure.  Dump the huge block diagram with all the sequences and roll it all into a state machine.  At least then you'd have a prayer at de-bugging it.

LabVIEW Pro & Measurement Studio Pro (VS Pro) 2019
Message 7 of 13

A.A.A. wrote:

Can you guys fix the code. 

No! LabVIEW 2010SP1 actually crashed whe I tried diagram cleanup. 😞 This needs ot be rearchitected from scratch.


The solution is two words "state machine" (or one word "statemachine" for Germans :D)

LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 8 of 13

NIquist, altenbach I really want to enhance my programing skills for future projects but I'm sad to say that I dont understand what you mean by state machine (almost all the replies on my previous posts ask to use state machine). Now that I summed up the courage 😛 can you give me a small example using state machine for two volatge read. Extra examples showing good state machine programs will be good.


0 Kudos
Message 9 of 13

There are a number of state machine examples that you can find on the NI website if you search, here is one (  When I looked at your code it screamed out to me PLEASE MAKE ME INTO A STATE MACHINE!  In designing a state machine think about the steps you need to take in order to achieve your end result, each step can be a state.  When making your custom control to select the cases make sure that the control is saved as a type def so its easy to make changes later.

0 Kudos
Message 10 of 13