NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I access a subsequence context from a parent sequence context?

I have a top level sequence file that creates a .NET DLL object and also stores the ThisContext object in the .NET object.  Then the top level sequence file calls a subsequence file with the .NET object as a parameter.  In the subsequence file, I have a step that calls a method on the .NET object, and that method needs to set the step status.  But trying to set the SequenceContext.Step.ResultStatus does not work, and I am pretty sure it's because SequenceContext.Step does not refer to the current step in the subsequence file -- I think it refers to the current step in the top level sequence file. 
 
Is there a way for me to get the current step in the subsequence file using the sequence context object for the top level sequence file?  I notice the Expression Browser says that ThisContext has a recursive subproperty called ThisContext, so it might be possible?  But I'm not sure which method to invoke on the SequenceContext object in my .NET code to do that.  I know I could pass in the ThisContext object from the subsequence file to the method that needs to set the status, but if I can access the subsequence context from the parent sequence context, then that would be the best solution.
 
 
0 Kudos
Message 1 of 3
(3,343 Views)
You will need to pass it as a parameter.  Parameters passed by reference can be used after they are returned.
 
Allen P
NI
0 Kudos
Message 2 of 3
(3,339 Views)
Hey Current,

I don't think there is a way to force your sequence context object to pertain to the currently executing sequence.  What we can do is get the sequence context for the currently executing sequence from your sequence context that is already contained within your .NET object.  From the sequence context, you can get a reference to the currently running execution.  Then from the execution you can get the foreground thread which should be your currently executing sub-sequence.  From the current thread you can get the thread's sequence context.  This should allow you to use the sequence context like you were intending to.  The only reason this might not work is if you were creating a new execution when you were jumping into your subsequence.  However, if I understood your post correctly, it didn't sound like you were doing this.  For more information, I would recommend taking a look at the help topics for Execution objects, thread objects, and sequence context objects within the TestStand help.  Hope this helps!
Pat P.
Software Engineer
National Instruments
0 Kudos
Message 3 of 3
(3,320 Views)