NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Terminate execution based on step output

Hi all,

 

I am looking for a cleaner way to terminate an execution based on the output of a step. I have a few simple VI's that prompt the operator, these give the operator the ability to cancel the execution as well as continuing the execution.

 

Up until now, I have been setting a local boolean (Locals.TerminateSequence) with the boolean output of the VI. I then check this with an if statement, and run RunState.Execution.Terminate() to terminate the execution if required.

 

I'm fairly certain that I can do this all in the steps post expression, but I cannot seem to figure out the syntax. If my VI has a "cancel" boolean output,what would be the correct syntax?

 

if(Runstate.Step.???"Cancel" ==  True) RunState.Execution.Terminate()

 

Getting the output of the VI is the confusing part for me, but I assume this is actually pretty trivial, and that my google fu is lacking.

 

Thanks!

 

0 Kudos
Message 1 of 5
(3,924 Views)

You still need the local variable passed out of the VI.

 

Locals.TerminateSequence ? RunState.Execution.Terminate() : False

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

Ahh! I thought I could get away without using the local.

 

Thanks for the help!

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

Technically you could get away without using the Local Variable.  You could create a step attribute and use that. 

 

In the Property Browser right click on Result and select Advanced>>Edit Attributes...

 

Then add an attribute of boolean type called Cancelled (or whatever you want to call it).

 

Then you can just use Step.Result.Attributes.Cancelled.

 

That way it goes with the step when you copy it.  But it does make the code a bit trickier to follow.

 

Regards,

 

 

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
Message 4 of 5
(3,911 Views)

Thanks!

 

I agree that the attribute will make it more difficult to follow. The local variable approach will work, and it'll help me clean up my code.

 

Thanks again!

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