From 11:00 PM CST Friday, Feb 14th - 6:30 PM CST Saturday, Feb 15th, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

if then else

Is there an equivalent to IF-THEN-ELSE in Teststand? I'm checking a step to see IF its between a ceratin value. If so, THEN execute that step, ELSE excute a different step. I tried the PRECONDITIONS tab in TS but how do I avoid executing the ELSE part of the step ?
0 Kudos
Message 1 of 3
(3,204 Views)
Clint,
You could use the Preconditions of the ELSE step so that it will only run IF the first step did not. So if the first IF is FALSE then that step is skipped and THEN the second step runs. Alternatively you could use the flow control step type here:-
http://zone.ni.com/devzone/explprog.nsf/6c163603265406328625682a006ed37d/b41f824037d5aef186256b9200736700?OpenDocument
0 Kudos
Message 2 of 3
(3,204 Views)
Clint,

If you want to jump over the "else" step when the "if" condition is true, use a post action in the "if" step to skip over the "else" step. You can just set the custom condition expresion to TRUE then in the On Condition True, jump to the step after the else.

For the simple if-then-else structure, I prefer to set the precondition of the "else" step to RunState.PreviousStep.Result.Status=="Skipped". This enables the two steps to be easily cut and pasted as no step names that may have to be changed are involved.

Howard
0 Kudos
Message 3 of 3
(3,204 Views)