NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set StationGlobal in Post-Expression if Step==Passed

Hello,
i´m running a teststep and want to set a StationGlobal to True if Step is Passed or False if Step is Failed.
Currently i´m calling a Post-Expression which is:

 (Step.Result.Status=="Passed")?
(StationGlobals.ProjectParameter.Result[0] =TRUE):
(StationGlobals.ProjectParameter.Result[0] =FALSE)

The problem is, that the Status is still "Running" in the postexpression and not passed ord failed.
So how can i set my StationGlobal without adding a new step?

Thx for your help
0 Kudos
Message 1 of 9
(4,099 Views)
Have you tried using the poststep callback??? Though, I am not sure how practical it'd be if you are using this only in one step.. but I'm sure it will work
0 Kudos
Message 2 of 9
(4,088 Views)

I just tried this in the postaction (CustomConditionExpression) of one step and it seems to work...

(

Step.Result.Status=="Done")?(StationGlobals.XYZ=TRUE):(StationGlobals.XYZ=FALSE)

0 Kudos
Message 3 of 9
(4,081 Views)
Hi,
 
Why don't you add an expression step right after your teststep and set its precondition as "PASS teststep" ?
Do you really have to handle it in the post expression?
S. Eren BALCI
IMESTEK
0 Kudos
Message 4 of 9
(4,064 Views)

Hi,

You can do this in the ProcessModelPostResultListEntry callback sequence. This is called after the step results have been evaluated.

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 5 of 9
(4,062 Views)

Hi Ray,

Doesn't modifying that callback sequence affect all steps?

If we use the callback but if we want to change the StationGlobal according to the result of a single step among many others then we will again need to put some effort in distinguishing the last executed step.
Am I right?

S. Eren BALCI
IMESTEK
0 Kudos
Message 6 of 9
(4,060 Views)
You are correct.
Trouble is you want to do something based on the result of the step but the Step result will not have been evaluated untill after the post expressions.
So you have a few options.
1) you could perform the evaluation the result in the post expression. (this does mean its going to be performed twice.)
2) have the next step perform the task with a precondition on the result of the step.
3) use the callback but because this affect all steps you will have to do some sort of check so only that step performs the update of your station global. Maybe you can put some Text in the step description that you can check for.
 
Regards
Ray Farmer 
Regards
Ray Farmer
0 Kudos
Message 7 of 9
(4,057 Views)
You are correct.
Trouble is you want to do something based on the result of the step but the Step result will not have been evaluated untill after the post expressions.
So you have a few options.
1) you could perform the evaluation the result in the post expression. (this does mean its going to be performed twice.)
2) have the next step perform the task with a precondition on the result of the step.
3) use the callback but because this affect all steps you will have to do some sort of check so only that step performs the update of your station global. Maybe you can put some Text in the step description that you can check for.
 
Regards
Ray Farmer 
Regards
Ray Farmer
0 Kudos
Message 8 of 9
(4,057 Views)

Hi Ray,

 

Thank you very much for this answer!!

 

I always use the post expression in order to set the step.ReportText.  Due to the order of evaluations inside the step, I could not use it (in some cases).  The option 1 in your answer makes it possible.   So simple, but yet....I didn't think about it.

 

Thanks

Rafi

0 Kudos
Message 9 of 9
(3,621 Views)