Showing results for 
Search instead for 
Did you mean: 

How to Static VI ref with variant Values converting to concatenated String

Go to solution



How can I convert the variant array to a concatenated string? I am trying to format the global variable for output to a text file. The global variable has too many variables to manually add each to an array. The report and ring can be removed from the global variable if needed -- I tried this and had no luck. I would prefer to leave the report and ring in the global variable to avoid having to make more global variables.


VI's made with LabVIEW 2021 SP1. 18 backdated version also included.


0 Kudos
Message 1 of 5

I think you will need to use the Data Type Parsing VIs to make a case for every variable type and then convert each one to a string individually.  You basically have a modified version of this problem where using those VIs is the solution.


If you put everything in the Global into a giant cluster you could use the MGI write anything function on it.

0 Kudos
Message 2 of 5

You could use an existing package that formats Variants in text form, such as JSONtext.

0 Kudos
Message 3 of 5
Accepted by CatDoe

Hello CatDoe,


I did not want to take credit for someone else's work, so I searched up the original post which provided the solution for me.

Using the VIs posted by Paul Cardinale worked perfectly for me.


For your application you should be able to use the Variant directly like this.


Message 4 of 5

Thank you kghzvi! This was super easy to adapt for my needs!


Note to future readers -- this VI puts both \r\n and an end of line constant at the end of the string. If you want a clean string without these additional characters you need to modify the end.


Helpful notes to remove line breaks and new line characters:

Convert String with Line Breaks to Single-Line String in LabVIEW - NI

0 Kudos
Message 5 of 5