NI TestStand

Showing results for 
Search instead for 
Did you mean: 

Using SetValVariant for TypeDef'ed data structures from LabVIEW --> Error

Go to solution

Hi there,


I am trying to set the value of a PropertyObject which is existing and is of a defined proprietary type.


Looking a the API for PropertyObject, it seems SetValVariant is the method to use.


From within a Sequence / Statement Step,it works


RunState.SequenceFile.AsPropertyObject.SetValVariant("Data.Attributes.Test.Test", 0, Locals.Test)


Yet, I need to doe this from LabVIEW, and that's where I get a type error



My intended use case is to write data generated in LabVIEW using a cluster (TestStand TypeDef Clusterpassing enabled and correctly configured)


For debugging I used the code module also directly form TestStand just to make sure passing Locals.Test as the variant value. Same error.


My conclusion is, Type information is getting "lost" using LabVIEW variants.


Any ideas on how to handle this correctly?


TS 2023Q4 LV2024Q1




0 Kudos
Message 1 of 4

To add some information:


the TestStand Type I am using is a composed type consisting of two typedefed containers and some additional information.

Cluster passing is configured correctly, I have double-cheked this.


Furthermore, I have changed the control on the LV FP from Type Variant to the appropriate LabVIEW Typedef. In the Sequence Editor, I can assign a variable of the composed type, no error here... yet still, the code module errors out the same way


Tried this as well with TS2019


My interpretation is, that this composition of custom data types is something which can't be resolved properly....



0 Kudos
Message 2 of 4

Reduced complexity.... same thing happens when using a "simple" Typedef without sub-definitions

0 Kudos
Message 3 of 4
Accepted by Oli_Wachno

It should work. The TestStand Help says it is supported (TestStand 2022 Q4 at least). 



But Types don't match 1:1 in LabVIEW/TestStand as seen here: Solved: Enqueue Teststand cluster to Labview, return a cluster by notification - NI Community. If you are doing a cluster/container type, you might have better luck setting the individual elements in the cluster that have 1:1 matches with LabVIEW instead of setting the whole thing. That's how I usually get around this by recursively going through the cluster. 

Message 4 of 4