09-26-2024 08:19 AM
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?
09-27-2024 09:23 PM
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.
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,
09-30-2024 01:39 AM
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:
Thanks for your reply!