NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass a reference to the current ResultList array from the process model to a C# library function. The array has 0 elements when I do this.

After Main Sequence Callback in the process model I carry out the following activex steps

1) Call AsPropertyObject with ThisContext

2) Use the returned object reference to call  Get Property  - Execution

3) Use the returned Execution object reference to call Get Property - ClientFile

4) Use the returned Sequence File object (my current sequence file that has just been executed) to Call GetSequenceByName with parameter "MainSequence"

5) Pass the returned Sequence object to my library function as a System.Object parameter

6) In my function the System.Object parameter is called aSequence and the following statements are

 

Sequence clientSequence = (Sequence)aSequence;

PropertyObject propertyObj = clientSequence.Locals;

PropertyObject resultListObj = propertyObj.GetPropertyObject("ResultList", 0);

int num = resultListObj.GetNumElements();

 

But there are no elements in the ResultList

When I call my function at the end of my test sequence file as a subsequnce call from the Cleanup section the elements are there.

I wish to isolate my process model steps to the process model, not have them in the test sequence file. Why does my ResultList array appear empty.

 

0 Kudos
Message 1 of 4
(3,495 Views)

Hi,

 

why not look at the process model, because when the MainSequence returns back to the Process Model Sequence (either Single Pass or Test UUTs), the ResultList is obtained from the Client MainSequence so that it can pass to the Test Report sequence. So you can put this up and pass it to your Step.

 

 

Regards
Ray Farmer
0 Kudos
Message 2 of 4
(3,490 Views)

What you are doing is getting the edit time version of that local variable. That will never have any results in it. You should instead look at how the process model gets the result of the MainSequence sequencecall step. That is the result you ultimately want to get. Look at the TestReport sequence call of the sequentialmodel.seq file's Test UUTs sequence and you will see that it is passing Locals.ResultList[0] as the mainsequence results object for that sequence's parameter. Make sure that you disable result collection on any other steps you add to this sequence in the process model as the only step that should have result collection enabled is the mainsequence callback sequence call step.

 

Hope this helps,

-Doug

0 Kudos
Message 3 of 4
(3,484 Views)

Thanks.

 

I changed my process model after the MainSequence callback to

 

1) Call AsPropertyObject with ThisContext

2) Pass the returned property object to my C# function as a System Object Parameter

3) In my function the System Object parameter is called TSContext and the following statements are

 

SequenceContext Context = (SequenceContext)TSContext; 

PropertyObject resultListObj = Context.Locals.GetPropertyObject("ResultList", 0);

int num = resultListObj.GetNumElements();

 

The results are now in ResultList.

 

 

0 Kudos
Message 4 of 4
(3,431 Views)