NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Post Expression in case of Runtime Error

I have a step type with a LabView module as post-step. The VI has an error cluster output. In cas of an error in the VI, I want to have the error code in the Post Expression, which looks like

Parameters.ErrorCode = Step.Result.Error.Code

 

I was wondering why the Parameters.ErrorCode is always 0, even if there is an error. Then I looked into the step execution order here: Step Execution - NI

 

The link says in the step 18, that "substeps" 19 to 22 will be skipped in case of a runtime error in the post-step --> that is the reason why the post expression in step 19 is not executed, thus my Parameters.ErrorCode still will have the default value. 

 

I need the error code from the LabVIEW error cluster. I have some workarounds in my mind, like:

- after the step causing runtime error, I add a statement step which accesses the RunState.PreviousStep.Results.Error.Code

- I add a numeric output to my VI holding the ErrorCode and pass it to a step specific variable

 

Has anyone faced this issue? Does anyone has a better idea as the above mentioned ones?  

0 Kudos
Message 1 of 3
(88 Views)

2 ideas:

 

Idea 1 - override the engine callback and set your variable in there.  This is probably the proper way TestStand meant to do what you want.

 

Idea 2 - Use the Post Action (i don't think it gets skipped).  I don't like this option very often but sometimes it is the only way.  

jiggawax_0-1727490105917.png

Using a comma will separate out expressions.  You want True to remain as your first expression and then in the second expression you can set your error code.  

 

Hope this helps,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 3
(50 Views)

Hi jiggawax, 

the second idea is a nice trick, but the result of the expression is expected to be boolean, so something like this works:

 

Madottati_0-1727678351760.png

Thanks for your reply!

 

0 Kudos
Message 3 of 3
(29 Views)