From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Determine Which Substep is Executing

Hello,

 

Does the SequenceContext object, passed into a C# method, provide a way to determine which substep called a method from within said method?

 

I have a custom TestStand type that has two substeps:

ScottTE_1-1612912324171.png

Both of these call the same code module and pass the sequence context to the function:

ScottTE_5-1612913126897.png

 

 

Without getting to far off into the weeds about what the function does, just know that it doesn't differentiate between an edit or a new step.  However, I need to change that.

 

What I need is a way to determine at design time (whether by dragging-and-dropping the step onto the editor -- OnNewStep, or by clicking an existing step's Edit button in the Step Settings window) which substep called my .NET method.  I am assuming that there's some flag or property buried deep inside the SequenceContext?

ScottTE_4-1612912796439.png

 

I've looked through the API documentation and these forums, but I am unable to find a way to do this.  Admittedly, I am not 100% confident I am even searching for the correct terms, so if it is hiding in here, I haven't found it.

 

I am sure there's a workaround I could use like overloading the method or something, but if it is possible to do it the way I describe above, I'd prefer that.

 

Anyway, thanks in advance for your input.  

0 Kudos
Message 1 of 2
(681 Views)

I'm going from memory, but try this in your code module:

 

string subStepName = sequenceContext.AsPropertyObject().GetValString("Runstate.SubstepName");

 

if that doesn't work, maybe this will:

 

string subStepName = sequenceContext.AsPropertyObject().GetValString("SubstepName");

 

0 Kudos
Message 2 of 2
(643 Views)