NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Testsocket index of a new Execution: how to get the Testsocket index of the caller

Solved!
Go to solution

Hi,

I need to get the Testsocket Index inside of a called Sequence (called as new execution with the sequential model). It seems that this variable: RunState.Testsocket.MyIndex is filled in this case with 0 and the count with 1. In the calling sequence these values are filled correctly.  

 

I also tested it with the parallel model (and the same sequence)  and the result was 4 new executions, so instead of 4, I now have 4x4 🙂 .....

If I do not use a process modell the reporting is not triggered (at least that's my understanding).

 

Is there any way how to get the testsocket index of the caller (like RunState.Engine.....caller.getTestsocket.MyIndex()  ??)

Otherwise I need to work with parameters and this means a complete new approach (different Syntax, different way to meassure execution time, etc...)

 

Thanks for your Help

 

Best Regards

Matthias   

0 Kudos
Message 1 of 2
(2,341 Views)
Solution
Accepted by topic author run321

Hi Matthias,

 

When you call a step in a new execution, you can store back an object reference to the new execution:

 

image.png 

image.png

So, you first create a variable of type Object Reference to hold this reference. Then, in the post expression for the sequence call, you can attach a new attribute to the execution object that contains the caller's socket index. In order for this to work, you have to explicitly cast the new execution object to a Property Object. 

 

image.png

Then, just use an expression to fetch that attribute into a convenient variable inside the new execution (again, you need to explicitly cast to a property object here to leverage the attributes).

 

image.png

 

You can find a simple example that just reports out the parent socket in a message popup attached to this post.

 

Regards,
Message 2 of 2
(2,292 Views)