NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Use TestStand error callback if in editor

Solved!
Go to solution

We have a custom error callback in our process model to display errors to the operator.  What we'd like to do is if in the sequence editor, use TestStands error handling (where it gives the options to cleanup, terminate, ignore, etc).  I don't see the code for that anywhere.  I could put in the example so that if in the editor, use the example which has similar options, but that has a different feel and form.  Is there a way to programattically use the built in callback vs. the process model callback that we have created?

0 Kudos
Message 1 of 9
(4,946 Views)
Hi,
 
You should be able to programmatically change the station options when you need the automatic error handling to take over. This can be done by using an f(x) Statement and using the expression "RunState.Engine.StationOptions.RTEOption = X"
 
X being the appropriate number as explained in the help here
Jason H
Automated Test Software R&D
0 Kudos
Message 2 of 9
(4,911 Views)

I can see how you can change the station options setting with that, but that doesn't impact how the callbacks work.  Our process model has a callback for when a RTE occurs that we want to display to our operators a very generic message with no options.  When running in the sequence editor, we'd like to have our developers have more options.  The only way around this currently is to rename the callback sequence temporarily in the process model so it is no longer the RTE callback.  But that is a real pain.  I'd like to have the option to use our generic display or the build in error handling depending on if IsEditor is true.  But I don't see a way to launch the TestStand built in error handling, which is the attached image here, which has some nice options for Run Cleanup, Retry, Ignore, Abort as well as Break and Don't show again.

 

0 Kudos
Message 3 of 9
(4,902 Views)
I have attached an example of how to do what I believe you are trying to accomplish.
 
In the example, the modified callback is SequenceFilePostStepRuntimeError. However, it can also be in the Process Model as ProcessModelPostStepRuntimeError. In the setup of the callback, there is a blank statement but in the post action property it checks to see if it is an editor. If it is an editor, it will skip the custom error handling and vice versa.
Jason H
Automated Test Software R&D
0 Kudos
Message 4 of 9
(4,871 Views)

we are running TestStand 2012 SP1, can you do your example in the older version?  I can't open as is (I assume 2013 is what you did this in).

0 Kudos
Message 5 of 9
(4,867 Views)
Solution
Accepted by topic author Sir_Mutt

Sorry about that. Try this one.

Jason H
Automated Test Software R&D
0 Kudos
Message 6 of 9
(4,862 Views)

@Sir_Mutt wrote:

We have a custom error callback in our process model to display errors to the operator.  What we'd like to do is if in the sequence editor, use TestStands error handling (where it gives the options to cleanup, terminate, ignore, etc).  I don't see the code for that anywhere.  I could put in the example so that if in the editor, use the example which has similar options, but that has a different feel and form.  Is there a way to programattically use the built in callback vs. the process model callback that we have created?


I think if you just do nothing in the error callback if you are inside the editor then it will work like you are wanting it to. You should be able to check Engine.ApplicationIsEditor in your callback to determine if you should do something or not.

 

-Doug

0 Kudos
Message 7 of 9
(4,859 Views)

Thanks Much.  That was much simpler than I thought it would be.  Brilliant.

0 Kudos
Message 8 of 9
(4,843 Views)

@friday_the_13th wrote:

Sorry about that. Try this one.


What this example shows in cleanup is not necessarily correct. That is causing the error to be ignored. If you instead want cleanup to happen as happens normally when an error occurs you can do the following instead to avoid the dialog:

 

RunState.Caller.RunState.ErrorReported = true

 

The basic idea is to do nothing in the callback when in an editor if you want to have the normal default behavior.

 

-Doug

Message 9 of 9
(4,832 Views)