NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I create a custom step type that has conditional substeps?

I want to create a custom step type that handles error information stored in Step.Result.Error, but I only want to do this in particular cases, such as when the error code is non-zero.  Is there a way that I can call my error handler conditionally based on the error code?  The error handler is in a DLL that I do not own and I would prefer not to write a wrapper function that implements my logic if I can avoid it.
 
Stephen
 
0 Kudos
Message 1 of 5
(3,429 Views)
Have you looked at using the ProcessModelPostStepRuntimeError callback?  You could add a step to the callback that has a precondition on the Error value.  You may know this already, but there is a C/C++ DLL adapter that can be used to create a step that will call the DLL directly without a wrapper.
0 Kudos
Message 2 of 5
(3,419 Views)
The ProcessModelPostStepRuntimeError callback or the SequenceFilePostStepRuntimeError callback is a more natural place to handle errors. Use SequenceFilePostStepRuntimeError if you want to put the code in your client sequence, or use ProcessModelPostStepRuntimeError  if you want to put it in the process model and have it in effect for all client sequences that run under that process model. There's an example in TestSTand/Examples/Callbacks/PostStepRuntimeErrorCallback.

cc
0 Kudos
Message 3 of 5
(3,404 Views)
This is true, but it will handle errors from different step types in the same way.  With this one specific DLL, we want to invoke some extra error handling before the runtime error callback is invoked.  Perhaps I can implement some logic in the callback that can check if the error came from the DLL.
0 Kudos
Message 4 of 5
(3,398 Views)

To address the original question, Substeps do not have preconditions or other flow control options. You are expected to put any conditional logic in the substep module you call.  Thus, if you use substeps for this, you will probably need that wrapper function you wanted to avoid.

0 Kudos
Message 5 of 5
(3,390 Views)