NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I get the size of conatiner which is kept in the array of conatiner?

Solved!
Go to solution

I have created an Array of Conatiner in Local variable (say Locals.Array_C). Within Array_C, I have few containers like Cont_1, Cont_2, Cont_3.

Lets consider that there are four(4) Number fields added in the Cont_2.

 

Here the number of elements in the Cont_2 is 4, but if I want to read this size through TestStand, how can I do that?

 

I also tried to use "Call PropertyObject.GetNumElements" ActiveX property, but I could not get how to set Object Refernce in this case.

 

Please help.

0 Kudos
Message 1 of 7
(3,860 Views)

Hi niru,

 

Note: A Container is not an array. So GetNumElements is not working on Cont_2. Because it is a container.

To determine the "Number of Elements" you have to use GetNumSubProperties.

 

If ALL elements in your Array_C AND in your Container_1,2,3,4 have the SAME type e.g. a number

you could place an array to the Array_C

 

Hope this helps

 

juergen 

  

 

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
Message 2 of 7
(3,851 Views)

Thank you for replying back.

 

In my actual sequence file, there is possibilty that are not SAME. Hence I will stick to GetNumSubProperties.

I tried using it, it asks for "Lookup string" as input. Can you please let me know what should be the proper string value to be entered, if we consider above attached example? How can I get the value 4 as output, for Array_C.1.Cont_2 using GetNumSubProperties?

 

Regards,

Niraj.

0 Kudos
Message 3 of 7
(3,838 Views)

Hi Niraj,

 

Please post your a small example as .seq

I will try to fix it.

I assume you are using TS2.0?

 

juergen

 

 

 

 

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 4 of 7
(3,835 Views)
Solution
Accepted by topic author Niraj2810

Hi,

 

Your problem is how you are specify the array part. It may also be what you are using as the reference.

 

Lets look ate the array part using the SequenceContext as the reference. The lookup string will be:

 

"Locals.Array_C[1].Cont_2.Elemen4"

 

If you are using the Locals as the reference the lookup string will be:

"Array_C[1].Cont_2.Element4"

 

 

Hope this helps

Regards

Ray Farmer

Regards
Ray Farmer
Message 5 of 7
(3,827 Views)

Thank you Ray,

 

The issue is resolved.

0 Kudos
Message 6 of 7
(3,813 Views)

niru -

 

I believe the lookup string you would pass to GetNumSubProperties would be "Locals.Array_C[1].Cont_2" if you're using the Sequence Context as a reference. If you were using Locals as a reference, it would be "Array_C[1].Cont_2".

 

Hope this helps!

Manooch H.
National Instruments
Message 7 of 7
(3,778 Views)