NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Step still executed after Execution.Terminate

In the process model I use I activated the ProcessModelPreStep Callback. The following call is performed in the ProcessModelPreStep: ActiveX call to the method Execution.Terminate. The used reference is: RunState.Execution. It all works OK and the sequence terminates but just before it terminates the step where the PreStep was pointing to is still executed. This is NOT what I want. I want that the sequence terminates direct! The call Engine.TerminateAll has the exact same effect, the execution terminates but the last step is still executed. How can I avoid that the last step is executed and still that everything will be terminated????
0 Kudos
Message 1 of 7
(4,044 Views)
Terminating is not sufficient because the step has already started to execute. In addition to terminating, use another ActiveX Step in your callback to set the Parameters.Step.CancelCurrentExecution property to True.

- James
Message 2 of 7
(4,044 Views)
Hi, I tried to set the property but for some reason I can't get it working. I used the following settings in my ActiveX step:

ActiveX reference: Parameters.Step
Automation server: Teststand API 2.0 (Ver 1.0)
Object Class: Step
Call Method or Access property
Action: Set Property Property: CancelCurrentExecution

Name:
CancelCurrentExecution
Type:
Boolean
Direction:
in
Value:
True

The result is the same a without. The step is still executed. I also tried to change the reference with the following results:

Runstate.Caller.Parameters.Step - Unknown variable or property name 'Step'
Runstate.Caller.Runstate.Step - No effects, step still executed.
Runstate.Step - No effects, step still executed.

I also tried to use '1' instead of True, doesn'
t make any difference.

The strange thing is that when I look in the Context when executing the sequence I can't find any CancelCurrentExecution property at none of the tried references.

What Am I doing wrong...please help me....

Greetings Maarten de Bree
0 Kudos
Message 3 of 7
(4,044 Views)
Did you put the step that sets the CancelCurrentExecution property before the step that terminates execution? If not, the property setting step won't run because the sequence has terminated.

I've attached an example that uses a SequenceFilePreStep callback. I tested the same steps in a ProcessModelPreStep callback and they worked there too. (The example is in TestStand 3.0 format.)
0 Kudos
Message 4 of 7
(4,044 Views)
Yes I did put them in the correct order,

Many thanks for making this example but at this moment we are still using TestStand 2.0. So could you please send me a TestStand 2.0 example ???

Thanks in advance,

Maarten de Bree
0 Kudos
Message 5 of 7
(4,044 Views)
Hmm. I tested the example with 2.0.1 and it doesn't work. Apparently 3.0 resolves a bug or issue with this property. If you want to use the CancelCurrentExecution property for this purpose, it looks like you will need to use 3.0. I'm sorry that it didn't work in 2.0.

If you only need this functionality for a limited number of steps, a workaround for 2.0 might be to set a flag that your code module checks that would cause it to exit without executing. Perhaps you could use the Step.CancelCurrentExecution property as the flag or you could check if the execution is terminating. Otherwise, you could just use a variable in TestStand or in your code module.

- James
0 Kudos
Message 6 of 7
(4,044 Views)
Hi James, Hi Maarten,

I also tested this step property in TestStand 2.0.1. and as result of my tests I can say the followings:
- If you set the CancelCurrentExecution property from a defined PreSubstep for a step type, than the step is not further executed (e.g. behaves normal)
- If you set the CancelCurrentExecution property from any other place (e.g. engine callbacks, sequencefile callbacks, post substep aso), then the step is executed normally (e.g. behaves abnormal)

The attached sequence file contains a modified MessagePopup step which has an additional PreSubstep that will set the Step.CancelCurrentExecution to the value of the Step.CancelExecution step sub-property.
When this sub-property is set to TRUE then
the message window is not shown anymore.

James, you're right, and Maarten, if you need this functionality for a limited set of steps then you can use this feature as a PreSubstep too.

Regards,
Silvius
Silvius Iancu
0 Kudos
Message 7 of 7
(4,044 Views)