NI TestStand

取消
显示结果 
搜索替代 
您的意思是: 

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

已解决!
转到解答

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

 

Oli_Wachno_0-1709113625317.png

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

 

Cheers

Oli

0 项奖励
1 条消息(共 4 条)
1,176 次查看

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 项奖励
2 条消息(共 4 条)
1,154 次查看

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

0 项奖励
3 条消息(共 4 条)
1,146 次查看
解答
已被主题作者 Oli_Wachno 接受

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

ShockHouse_0-1709304767379.png

 

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. 

4 条消息(共 4 条)
1,139 次查看