NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Pass Cluster Type Value from TestStand to UI Using TestStand API

I need to pass Cluster data to a LabVIEW UI using TestStand API.

 

And now I can use the method GetValVariant to pass an array from TestStand. But I always get an error when I try passing a cluster.

 

How can I pass a cluster like passing array?

0 Kudos
Message 1 of 12
(6,195 Views)

Hi,

 

what do you mean with "I need to pass Cluster data to a LabVIEW UI using TestStand API"? To pass a cluster from TestStand in a LabVIEW VI you can:

 

- pass the cluster througt parameters. When creating the cluster (or container) in TestStand in the types pallette please make sure to check the "Allow objects of this type to be passed as LabVIEW clusters" (see attach1). Else it won't work. Then simply pass the cluster from TS to LV through the parameter (attach 2)

 

 

- or you can access every TestStand property in the VI by passing the sequence context in the LabVIEW VI. Look at the shipping example "AccessingPropertiesAndVariables.seq".

 

Cheers,

cheggers

Sascha
Download All
0 Kudos
Message 2 of 12
(6,178 Views)

Are you using UI Messaging?  If so then I would pass the sequence context and then access the Container through a lookup string.  Then I'm not sure if it will work but you should be able to use a typecast to get it to the datatype you want.

 

Regards,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 3 of 12
(6,171 Views)

Hi, cheggers & jigg

 

I'm using UI Message and I have been able to get a number, boolean, string and array from a running sequence in LabVIEW.

 

But I always got an error when I try to get a container type data even I set the container type can be passed as a cluster.

 

And the picture shows what I'm using.

 

 

0 Kudos
Message 4 of 12
(6,112 Views)

jigg, typecast function can not accept variant type.   😞

0 Kudos
Message 5 of 12
(6,107 Views)

You have to get the individual cluster elements one API call at a time. For example:

 

double mynumber = myClusterPropObj.GetValNumber("myNumberElement", 0);

string mystring = myClusterPropObj.GetValNumber("mystringelement", 0);

 

There is no automatic conversion from a TestStand type to a labview cluster using the API. The adapter will do automatic conversion if you call a vi from the labview adapter, but it you are not using the adapter, you have to access each element directly.

 

Hope this helps,

-Doug

Message 6 of 12
(6,090 Views)

Thanks!

0 Kudos
Message 7 of 12
(6,078 Views)

Hello,

 

Can you please post the code that solved your issue?

I have the same problem passing multiple data and data types to a callback VI using the TS UI msg.

 

Thanks,

0 Kudos
Message 8 of 12
(5,309 Views)

Hello, LevKL

 

My solution is:

 

Flatten your cluster into a string (such as XML string) and pass the string instead of the cluster. You may need the cluster type to rebuild it in the UI.  🙂

 

Message 9 of 12
(5,302 Views)

Hi,

 

Thanks for the help, I've got it working using this method.

0 Kudos
Message 10 of 12
(5,288 Views)