Jump to content

Variant data type

From LabVIEW Wiki
Revision as of 06:03, 15 March 2008 by Dsaunders (talk | contribs) (Added a little information, still little more than a stub)

A variant is a data type that any other LabVIEW data type will coerce to and that can contain any other LabVIEW data type inside it. In order to do useful things with variants, you will need to inspect the type descriptor to determine the actual data type flowing through the variant at run-time. When working with variants, it is recommended to use tools such as the OpenG LabVIEW Data (Variant) Tools Library.

Variants work really well for sending messages that may contain different types of data accompanying the message. This can be done as a cluster containing either a string or an enumerated type as the first element and a variant as the second. Another method is to convert the message (string or enum) to a variant and then add the data into the attributes.

Variant attributes are data elements that are stored and retrieved by name. This can be very beneficial if your data is best accessed by a name.

External links