NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set error-cluster in postexpression?

Solved!
Go to solution

Hello,

i created a c#-driver that returns a 0 for pass or -1 for fail in all functions "int MyFunction()".

Now i am using this functions for teststeps.

 

Question is: How can i use this returnvalue to set the error-cluster?

So that a -1 creates an error.

 

I think this can be done in the post-expression somehow.

How do i put a

if (returnvalue == -1)

{

Result.Error.Code = 10100

Result.Error.Msg = "Error occured"

Result.Error.Occured = True

}

 

Thanks for help

0 Kudos
Message 1 of 3
(3,606 Views)
Solution
Accepted by topic author OnlyOne

Hi OnlyOne,

 

Check out this Example (saved to TS4.0)

The trick is done by using a conditional and literal breakets.

Locals.nReturnValue == -1 ? {Step.Result.Error.Code = 10100,Step.Result.Error.Msg="Error occured", Step.Result.Error.Occurred = True } : {}

 

Regards

 

Juergen

 

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
Message 2 of 3
(3,598 Views)

Exactly what i was looking for.

Thx1!eleven

0 Kudos
Message 3 of 3
(3,592 Views)