NI TestStand

Showing results for 
Search instead for 
Did you mean: 

How to iterate Over a container in teststand


In my sequence, I use a variable that is a container with 20 fields that are booleans, numbers and strings.
How can I Iterate over the container with a loop to test each element value?

0 Kudos
Message 1 of 5

Hi Yazid,

Using your Container as the reference to the method PropertyObject.GetNumSubProperties("") this will return the number of subproperties within your container.

You can then use this as the maximum loop count.

You can then get the Name of the subProperty using Locals.subPropertyName = PropertyObject.GetNthSubPropertyName("", Locals.index, 0) this will return a string.

You can use this to obtain the type using PropertyObject.GetType(Locals.subPropertyName, 0, Locals.isObject, Locals.isArray, Locals.typeName) this returns the type of the subproprety eg (boolean, Number, String etc)

You can then decide which of the GetVal methods to use. eg if a sub-property is a string but not an array then you could use

Locals.subPropertyObjRef = PropertyObject.GetPropertyObject("Locals.subPropertyName, 0)

Locals.stringValue = PropertyObject.GetValString("", 0)

You can find information of the PropertyObject Methods in the TestStand Programmer Help.

Hope this gets you started.


Ray Farmer

Ray Farmer
Message 2 of 5
Thank You Ray Farmer

This works well .

Best regards
0 Kudos
Message 3 of 5



This way have been used in my TestSystem using TestStand 4.2.1 and works fine but now I'm migrating to 2013 and this "PropertyObject.GetType(Locals.subPropertyName, 0, Locals.isObject, Locals.isArray, Locals.typeName)" is obsolete and the sequence is not working. I have tryed to use different ways off getting the type but haven't been successful.


Some one have a way to do this?


Regards Lars

0 Kudos
Message 4 of 5

You need to obtain a PropertyObjectType which is done by PropertyObject.Type

Now you can get the value of the type by PropertyObjectType.ValueType

Hence for your Step 'get type' use




When you get the value eg Locals.OutString use Locals.subPropertyObjRef.GetValString("",0)




Ray Farmer
0 Kudos
Message 5 of 5