NI TestStand

Showing results for 
Search instead for 
Did you mean: 

Determine Which Substep is Executing



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:


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




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?



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

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