LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Jump over the first loop?

Hello!

See the attached VI. But do not run it!! Only open it so you can see the problem.

We are building an array with sampelnr and signal name. In our program the "sampelnr" is filled up, but this you can not see in this VI... the problem is that we want to jump over the first run, when the size of the "sampelnr" still is zero because we initiate the array the first time and then it is empty. Then the second time, we want to go into the case.

And there is one moore thing. When the dialogboxes shows and one click any button we want to quit or just continue the program...

Any tip or ideas about these problems?
Thank you and best regards.
0 Kudos
Message 1 of 6
(3,151 Views)
Right click the case and add an empty case to handle array size 0. Since it's empty, nothing will happen.

To stop the loop, add an OR before the terminal, then place a NOT after the message VI and wire the NOT into the second terminal of the OR. When you click Yes (continue) the not will turn it into F and the loop will not stop.

___________________
Try to take over the world!
0 Kudos
Message 2 of 6
(3,144 Views)
Hello!

Thank you for your tip. We have tried that but maybe there is something else in our program that is wrong... thank you anyway!

Best regards.
0 Kudos
Message 3 of 6
(3,136 Views)
It is not at all clear to me what you're trying to do, but the simplest way to jump over the first iteration of a loop is to wire the iteration terminal to an =0 function and then wire this to a case statement. The case statement would be empty on the true case (or have your initialization code) and would have your remaining code in the false case.
0 Kudos
Message 4 of 6
(3,122 Views)

@Ex-jobb wrote:
... the problem is that we want to jump over the first run, when the size of the "sampelnr" still is zero because we initiate the array the first time and then it is empty.

Here we are talking about the big case structure. A better solution would be to skip the code whenever the array size is zero, even if it is not the first run. Here the solution of tst seems reasonable and it should work.
You don't need a case "1", because the default case also handles arrays with size 1 correctly.


@Ex-jobb wrote:
And there is one moore thing. When the dialogboxes shows and one click any button we want to quit or just continue the program...


Clearly, many things are missing from the program, because the array never grows so it would no make sense to loop at all because the data does not change. In any case it needs to run only once and it should not depend on which button is pressed.
IF you want to stop or continue the loop depending on which button is pressed in the dialog box, just tap into the dialog box output and use it for the loop condition.
Attached shows a possibility.
0 Kudos
Message 5 of 6
(3,106 Views)
I had overlooked the outer case structure (it wasn't on my screen because of the large size of the diagram). Tst's solution will work for all cases where the array size is zero. However, is there a reason that you need to determine the array size? Is there something in your code that could cause the array size to return to zero? I realize that you have only attached a portion of your code which doesn't give the full picture of what you're trying to do.

If there's nothing in the code to cause the array size to return to zero and you don't need to know the array size at any point in your code then there is no need to compute the array size. Just change the large case structure to initialize the array at i=0 and run the other code in the default case.

Altenbach is correct that you should be able to consolidate your code from the default case and case 1 into a single default case. I've not looked at his example but I'm sure that it will be useful.

Message Edited by John Rich on 04-19-2005 11:38 AM

0 Kudos
Message 6 of 6
(3,091 Views)