Jump to content

Writing out Variable Name and Value


amaggs145

Recommended Posts

In an application that we are using, we have many variables, they are stored in a data structure as variants although their type varies. I would like to be able write their names and values out to an XML file using a string as the name and just the variant as the value. This works for one element, however when I try to write them all out using an array I get Error 1. I have attached the VI. Maybe there may even be a better method for doing this, any suggestions are welcome. Thanks

Write Variable Name and Value.vi

Link to comment
Share on other sites

I think that this might be the type of solution you're looking for:

 

Variables Array to XML.png

 

 

It outputs the following XML.

 

<Variables>
 <Var_1>true</Var_1>
 <Var_2>0</Var_2>
</Variables>

 

 

Note that this uses some OpenG VIs that are probably already installed on your system (since EasyXML depends on them).

Link to comment
Share on other sites

  • 2 weeks later...

Yes, that is what I was looking for. Thank you very much. Just out of curiosity, within the XML VIs, when writing values to the XML file does it use the OpenG VI "Format Variant Into String" ?

 

Thanks,

Anthony

 

Yes, it does use OpenG VI "Format Variant Into String" for at least flattening some data types, but not all types.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.