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
(95 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
(57 Views)