Write Readable Variant Data To a Text File

Updated Oct 13, 2023

Reported In

Software

  • LabVIEW Base
  • LabVIEW Full
  • LabVIEW Professional

Issue Details

I have variant data that is displaying in a readable format in a variant indicator. How can I convert that readable data to a string and print it to a text file?

Solution

Converting variant data to a readable format can be difficult because it contains both the actual data and metadata about the type and format of the data. Therefore, there is no single function to convert variant data to a readable string. Instead, you can refer to the Data Type Parsing VIs palette to parse the variant data appropriately. An example of how to properly implement these functions can be seen in a discussion at NI Community: Writing data to a text file from a cluster.

 

Additional Information

Another workaround for this issue is to wire the variant data to the Flatten to XML or Flatten to JSON functions. Both of these functions provide readable data but in the format of XML or JSON, not strings.