LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I convert variant string display into a string?

If I convert a cluster into a variant and then view the variant on the front panel it provides a good summary of the contents of that cluster in a string format.

Is there any way I can obtain the front panel display string so I can use it in the Labview program?

 

This would be very useful for a situation where I have a variety of clusters and want to be able to convert the data into string format so I can dislpay it on an Excel chart.

0 Kudos
Message 1 of 4
(3,815 Views)

 

I did find this: http://digital.ni.com/public.nsf/allkb/F6844F4999ED2BB1862576C00050360E 

 

It suggested "Flatten to XML", which is now under "programming, string, xml"

 

I've had a look and that's sort of what I want to do. It would still be interesting to see if there's a way of accessing the front panel variant string.

0 Kudos
Message 2 of 4
(3,806 Views)

[quote]
Create a VI that takes in a variant, and gets a list of all data types contained within the variant. Use a case structure to handle how to parse the data for every datatype that the variant can possibly contain. Use the Variant to Data VI and Fomat into String VI to convert the data from the source type to string.[/quote]

Any idea how I get a list of all data types within a variant?

0 Kudos
Message 3 of 4
(3,798 Views)

There are a few VIs in the vi.lib\Utility\VariantDataType folder that you can use. These do not show up on the palette, so you have to navigate to the folder to use them on the block diagram. For example, the "GetClusterInfo" will return an array of variants for each cluster element. You can drive a for-loop to get information about each cluster element, such as by using the "GetTypeInfo" VI inside the loop.

 

OpenG also has a set of VIs to work with variants. You can install the "OpenG LabVIEW Data Tools" library.

0 Kudos
Message 4 of 4
(3,786 Views)