06-01-2011 10:46 PM
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?
06-02-2011 04:26 PM - edited 06-02-2011 04:26 PM
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
06-02-2011 05:10 PM
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,
06-09-2011 04:02 AM
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.
06-09-2011 04:07 AM
jigg, typecast function can not accept variant type. 😞
06-09-2011 10:04 AM
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
06-09-2011 09:19 PM
Thanks!
10-10-2013 10:10 AM
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,
10-10-2013 11:46 PM
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. 🙂
10-13-2013 07:11 AM
Hi,
Thanks for the help, I've got it working using this method.