Jump to content
amaggs145

Writing out Variable Name and Value

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

Share this post


Link to post
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).

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

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