NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to programmactically read custom data types (Container with elements)

How can i programactially know what are the elements in the customdata type. Array , boolean names etc.
0 Kudos
Message 1 of 2
(3,354 Views)
Hi Naresh,
you don't say what environment you need the information in, or what format. I've attached an example in TestStand 2.0.1f1 and LabVIEW 6.1. Just in case you're not useing this, here's a description of the sequence version so you can re-build it in your favoured language :

I started out with a custom data type, and made a local variable of this type for the main sequence.
I then called my LabVIEW .vi module as an action step.
Inside the .vi, I used the sequence context to get the local variables (SequenceContext get locals property). From this reference, I call the PropertyObject method GetPropertyObject, passing in the lookup string "CustomVar1" which is the name of the local variable. From this reference, I then got the number of sub-properti
es (PropertyObject Method GetNumSubProperties with a lookup string of "" to specify the current propertyobject).
I use this number to index a For Loop. Inside the loop, I use the current propertyobject and call the method GetNthSubPropertyName. The Lookup string is "", and the index is the loop index (0 to the number of sub properties-1). From the NthSubProperty name, I call the method GetTypeDisplayString, passing in the NthSubProperty name as the lookup string. The resulting TypeDisplayString is then passed out of the For Loop to create an array of types listing for the first level of the variable, which is then sent to the front panel to display.
In the LabVIEW code, you need to tidy up by closing the reference to the property object and to the locals.

Instead of using the GetTypeDisplayString, you could call GetType which returns a number instead (which is what I did in the LabVIEW code.)

Hope that helps

S.
btw, I can do a sample in CVI if you need it.
// it takes almost no time to rate an answer Smiley Wink
Download All
Message 2 of 2
(3,354 Views)