NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Numeric Limit Test boolean result

Is there an easy way to get a boolean result from a Numeric Limit Test? I thought this would be easy. In the Post-Expression I tried this:

Locals.result= (Step.Result.Status =="Passed")

 But the Step.Result.Status apperently doesn't update until after the post-expression. It's not a big deal, there are many ways around it; get the PreviousStep.Step.Result.Status in the next step, use a Pass/Fail test instead, etc... 

I just thought there would be an easier way to get a boolean result directly from a Numeric Limit Test step itself. If anyone knows how...let me know.

 

 

0 Kudos
Message 1 of 6
(4,936 Views)
Do this:

Evaluate(Step.StatusExpression) in the PostExpression.  That will evaluate the Status expression ahead of time for you and return the result.  It will only work in TS 4.0 or higher.  If you are using 3.5 or lower, you can use this:

Evaluate(Step.TS.StatusExpr) in the PostExpression.

Allen P.
NI
0 Kudos
Message 2 of 6
(4,928 Views)

Hi John,

Solution 1.
What about using the PostResultListEntry Callback? Do a wrapper inside it and filter the NumericLimitTest. Now you can do your boolean result.

Solution 2. (I have not tested this ! just theory)
Copy the stuff from StatusExpression to PostExpression and do a string compare around it 
Locals.bResult = (StrComp( CheckLimits(Step.DataSource == "Step.Result.Numeric" ? Step.Result.Numeric : (Step.Result.Numeric = Evaluate(Step.DataSource)), Step.Limits.High, Step.Limits.Low,Step.Comp),"Passed") == 0 ) ? True : False

Solution 3.
Create your own step-type derived by Ni's one.
Now you can define your own Status exepresion.

Hope this helps

Greetings

Juergen

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 3 of 6
(4,925 Views)
I think the best thing to do is use a precondition on any steps after that step where you care about what the result of that step was. That's the purpose of preconditions (and condition builder in "If" and similar steps). If you really need a boolean local variable as a result you can always use a statement step after that step to set it, however I think what most people do is use preconditions and not store the boolean result anywhere.

-Doug


Message Edited by dug9000 on 03-26-2008 10:25 AM

Message Edited by dug9000 on 03-26-2008 10:29 AM
0 Kudos
Message 4 of 6
(4,898 Views)

Thanks for the responses. As I stated in my original post, I didn't really want to use a second step nor do anything 'extra' like creating a custom step. So AllenP's solution and j_dodek's Solution 2 were what I was looking for.

 j_dodek, your Solution 2 does work. But.....man..is that ever an ugly looking expression!Smiley Happy

So I did some trial and error and actually kind of used peices of both ideas and in the end came up with this:

Locals.result=(Evaluate(Step.StatusExpression) =="Passed")

How easy! I can't believe I couldn't come up with that on my own before. It works and its simple so if anyone else looks at my sequence they can figure it out. Now I can easily get a boolean result directly from the post expression of my Numeric Limit Test steps. Thanks again for the responses.

 

Message 5 of 6
(4,883 Views)
Hi John,
 
You are right! really ugly ! But your solution is very nice simple AND short!!. Time to give a 5!
 
Greetings from the Lake of Constance, Germany
 
Juergen 
--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 6 of 6
(4,877 Views)