LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Decode variant data w/o using 'Variant To Data' function.

I need to decode variant data w/o having foreknowledge of the type used to create it. That is, I'm using the 'Flattened String To Variant' function which gives me the info I need, but it's all contained within one indicator. I need some way to break this info down into its constituent elements.

For instance, let's say I have the flattened data and type descriptor from a cluster with two elements, a boolean and a string, but not the structure itself. Passing this flattened data and/or the type descriptor into a function, I would get a 2D array (or the like) as output containing the name of the boolean (its label), its value, and the name of the string and its corresponding value.

There must be a way to
do this, and I suspect it's been done already, but I can't find any reference to it.

I have attached a file named Test.vi which demostrates this problem.

Remember, even though I know the name of the control, I won't know the type, so I cannot use the 'Variant To Data' function to deference these values. I can make ready use of DLLs, CINs, or LabVIEW code for the solution.

Thanks ahead of time for any help! Greg
0 Kudos
Message 1 of 2
(2,526 Views)
You might be able to take advantage of the Variant to Flattened String VI from the Advanced>>Data Manipulation>>Variants pallette. This VI converts a Variant to a flattened data string and a type descriptor. The type descriptor is explained in ap note 154. You might be able to create a VI that would parse data from the flattened data string using the type descriptor. You might have to represent each piece of data as a flattened string to work around the data flow issues in LabVIEW.
0 Kudos
Message 2 of 2
(2,526 Views)