NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I reach a subsequence with Csharp to get step results

Solved!
Go to solution

Hi,

 

I want to reach a subsequence programatically. I used CSharp just in order to get the step results, not to create an execution. I am starting my execution in TestStand. And in clean-up step group, I added an "Action" step to collect results, which will be used in another platform, from TestStand.

For this purpose, I wrote the following code:

 

int seqIndex = seqContext.SequenceFile.GetSequenceIndex(propObj.GetValString("Locals.ResultList[" + i.ToString() + "].TS.SequenceCall.Sequence", 0));
Sequence subSeq = seqContext.SequenceFile.GetSequence(seqIndex);
Above code module returns the main sequence belonging to the actual sequence. seqIndex was 0. I have changed the name of the sequence. Nevertheless, it doesn't work and the subsequence couldn't be found.
I used another method;
string name = propObj.GetValString("Locals.ResultList[" + i.ToString() + "].TS.SequenceCall.Sequence", 0);
Sequence subSeq = seqContext.SequenceFile.GetSequenceByName(name);
Above code module again gives me the main sequence belonging to the actual executed sequence. I have changed the name of the subsequence from MainSequence to TempSeq. This time it showed me a message like "TempSeq sequence could not be found".

So, how can I reach my subsequence programatically in CSharp?

 

 

 

0 Kudos
Message 1 of 3
(3,602 Views)
Solution
Accepted by topic author Ebru

Hi Ebru,

 

Subsequence results are actually stored in their own resultlist container within TS.Sequencecall, which is accessible through the following statement:

 

Locals.ResultList[step].TS.SequenceCall.ResultList

 where step is the index of the sequence call step. This resultlist is structured in the same way as the main resultList array. You can also access your subsequence directly from the sequence file container if it is in the same sequence file as the main sequence.  Navigate to this reference using the following:

 

RunState.SequenceFile.Data.Seq[sequenceName]

 Using this reference, you can access the containers for each step's result container.

 

Hope this helps!

Al B.
Staff Software Engineer - TestStand
CTA/CLD
0 Kudos
Message 2 of 3
(3,578 Views)

Hi again,

 

After typing this message, I realized that I had forgotten to add my subsequence to Sequences pane (I expected that just using Sequence Call was enough).

 

Thanks for the reply.

 

Ebru

 

 

 

 

0 Kudos
Message 3 of 3
(3,547 Views)