LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
dsloan

Ability to extract and insert text show in variants

Status: Declined

Any idea that has received less than 4 kudos within 4 years after posting will be automatically declined.

I really like to use variant attributes for storing different data types.  It is very fast and easy to retrieve attributrs (Darin had a weekly nugget on this see here).  Now when I look at a variant with attributes I see something like this:

 

Variant.jpg

 

I would really like to be able to extract the text, exactly as it appears in the variant, so I can do things like save it to a txt file.  Then I would like the ability to load that text and put it back into the variant.  I was very surprised that this can't be done.

 

Flatten to XML does this:

 

Flatten to XML.jpg

 

And flatten to string does this:

 

Flatten to string.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

4 Comments
altenbach
Knight of NI

Having a way to format variant data to a string has been discussed before the existence of the ideas exchange. Here is an example. That's a reasonable request.

 

You lose me when you want to be able to extract everything as text and then be able to go back to the variant. What if somebody edits the text so it is malformed? For efficient storage and retieval I would stay with binary data. Variant attributes allow any of the 255 characters, so in the general case it would be "garbled" anyway when displayed as plain text.

You can already store and later fully retrieve a variant using a binary file and that's all we really need.

dsloan
Member

I also like saving things to binary files which is what I typically do.  But in some cases the folks I work with want the ability to open files, especially settings files, and view the content.  Obviously this is something they cant do with a binary file using a text editor.  Being able to extract and set the text from a variant would really be a great method for easily creating human readable text files.

AristosQueue (NI)
NI Employee (retired)

The variant text is just a debug view... the strings therein are not generally parsable back into the original data types. It's a very lossy display, meant to give you some insight. We would have to change the format strings to something a good deal more rigorous.

Darren
Proven Zealot
Status changed to: Declined

Any idea that has received less than 4 kudos within 4 years after posting will be automatically declined.