NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use if else condition to determine sequence pass fail

Solved!
Go to solution

I have a sequence where I need to determine its pass fail status by comparing two values. The values are returned by different LabVIEW vis', say. Locals.ValueReturnedByVI_1 and another value say  Locals.ValueReturnedByVI_2. Now, I intend to compare those values using a If-Else Condition and determine whether this sequence has passed or failed.

 

If (Locals.ValueReturnedByVI_1 == Locals.ValueReturnedByVI_2)

/*This sequence has failed*/

else

/*This sequence has passed*/

End

 

I dont know what should be done inside the conditon blocks to state the pass-fail of the sequence.

Or is there a better way to do this?

0 Kudos
Message 1 of 4
(6,017 Views)

Hi,

 

You could try a ternary condiiton statement in the Post-Expression function of the sequence.

 

Something like;

 

Step.Result.Status = (Locals.ValueReturnedByVI_1 == Local.ValueReturnedByVI_2)?"Failed":"Passed"

 

Curt

Message 2 of 4
(6,015 Views)
Solution
Accepted by AnandAbhishek

Another option would be to use a Pass/Fail Test step with no adapter. Set the Data Source Expression to Locals.ValueReturnedByVI_1 == Locals.ValueReturnedByVI_2.

 

The biggest difference I can think of is how the result would be displayed in a report. I would keep that in mind as you choose how to approach this.

Steven Gloor
Staff Customer Engineer - CTA, CLD
Message 3 of 4
(6,006 Views)

I used this method. The result generated is according to the formats we follow.

Thank you Steven and Curt for the help.

0 Kudos
Message 4 of 4
(5,981 Views)