LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Recalling my vi

I am trying to create a vi that performs error checking on certain values. If the values are false I present a pop-up message asking the user to re-enter the values. How do I create this recursive function?
0 Kudos
Message 1 of 4
(2,732 Views)
Sounds like a perfect reason for using a state machine architecture. There a couple shipping examples that you can review and numerous other ones on NI Zone. Basicaly, what you'll end up doing is check the values, if okay then go to a state (a case in a Case Structure) that uses them, and if invalid, clear the values and set the next state to be the data entry one.
0 Kudos
Message 2 of 4
(2,732 Views)
Hi,

You don`t need a recursive function. You can check the inputted values before exitting the VI and passing on the values(Assuming you have a pop-up VI for entering the values).

Running such a check in a loop, controlled by a "finished" boolean button or whatever, you can check each value serially for validity, and only leave the loop if the user presses "finished" and all values are OK. A nice touch would be to set the name of the controls with invalid values to a different colour (Red usually works). You can even let the input loop run WHILE the user is inputting the values (Loop won`t exit until the user presses "finished"), so that the user has a real-time feedback of which values are valid or not.

This is how I would do it. Hope it helps.

Sh
ane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 3 of 4
(2,732 Views)
Salutations!

The traditional means of performing this sort of thing is with a State Machine, of which there are a few examples in the Execution Control directory of the Help files. It's really just a case structure inside a shift register, where the last state is transferred to the next "card in the stack" You have to explicitly insert each possible case inside the structure, so this can get tedious for large numbers of cases, but in your situation, it should be a snap.

Hope this helps!

Eric
Eric P. Nichols
P.O. Box 56235
North Pole, AK 99705
0 Kudos
Message 4 of 4
(2,732 Views)