Jump to content

Bug in 'Convert from XML' ?


Recommended Posts

I can't get the 'Convert from XML' function to work when the input type is a variant, see attached code.

Am I doing something wrong, or is this a bug?

Code picture:

post-833-1163832510.png?width=400

Code:

Download File:post-833-1163832727.vi

********** UPDATE***********

I found the answer to my question at this ni.com site where it says: "Although you can flatten LabVIEW variant data to XML, attempting to unflatten variant data from XML results in an empty LabVIEW variant". So it's a feature, not a bug.

Background: I wanted to write a VI which stores all control values of its calling VI to an XML file, and reads them back. In my first approach I had accessed the calling VI's 'Panel' refnum to obtain the Controls[] refnum array and from them the Value property, which is a Variant. That I wanted to write and read to XML. This does not work due to the reason above. I will now try to use the 'Get all control values' method node to access the calling VI's controls. That method delivers a (flat data|type desc) pair for each control, which should allow to do what I want.

BTW: A VI doing what I describe above should have been written by someone already, but I couldn't find it. I'd be grateful if there is such a VI and somone can point me to it.

-Franz

Link to comment
BTW: A VI doing what I describe above should have been written by someone already, but I couldn't find it. I'd be grateful if there is such a VI and somone can point me to it.

-Franz

OpenG has a VI to save the front-panel contents of a VI into an INI file. That's the fastest route I know.

Normally I use the cluster to INI file function

Ton

Link to comment
Background: I wanted to write a VI which stores all control values of its calling VI to an XML file, and reads them back.

There's a weird piece of LV functionality that might help with this. Drop an subVI onto any block diagram, then popup on it and choose "Enable Database Access". This puts a funky yellow halo around the subVI with extra terminals. This lets you do FP querrying for historical values of the FP of the chosen subVI. Details are here:

http://zone.ni.com/reference/en-XX/help/lv...Logged_FP_Data/

This is a feature that doesn't get used often, but I've always thought it was an interesting idea. It seems like there ought to be more you could do with this "halo" concept, but it's never really been expanded on, and most LV developers think its kinda lame. Still, it might be interesting for you in this case.

Link to comment
There's a weird piece of LV functionality that might help with this. Drop an subVI onto any block diagram, then popup on it and choose "Enable Database Access". This puts a funky yellow halo around the subVI with extra terminals. This lets you do FP querrying for historical values of the FP of the chosen subVI. Details are here:

http://zone.ni.com/reference/en-XX/help/lv...Logged_FP_Data/

This is a feature that doesn't get used often, but I've always thought it was an interesting idea. It seems like there ought to be more you could do with this "halo" concept, but it's never really been expanded on, and most LV developers think its kinda lame. Still, it might be interesting for you in this case.

Thanks, I knew that one and I used it long time ago for retrieving data that had been measured with a 'quick&dirty' assembled aquisition program. I hadn't even found the time to write the 'save to file' part of the VI at that time and therefore used the data logging feature of LV. In order to retrieve the data for processing later I used this 'enable data base' access trick. It all worked nicely but at one point I changed the main VI (added or modified controls) and didn't save the old version. I could no longer access the old log files, since they are binary and could only be read when the controls and indicators were exactly as specified in the log file's header part.

After that bad experience I stayed away from the log files, but I agree that the technique might be helpfule here. I'll check it out.

But for now I finished the XML approach and I attach the first version here, maybe it is helpful for others:

Download File:post-833-1163876298.vi

regards

Franz

OpenG has a VI to save the front-panel contents of a VI into an INI file. That's the fastest route I know.

Normally I use the cluster to INI file function

Ton

Thanks for the tip, Ton! I actually had thought about that but I had problems lately to download the OpenG software. Do you know a working download link?

Franz

Link to comment
Thanks for the tip, Ton! I actually had thought about that but I had problems lately to download the OpenG software. Do you know a working download link?

Franz,

Lately the OpenG has made a rather shocking movement, the openg commander became obsolete (there will be no further updates). It is more a nice study VI for how complex programs can be written.

Now downloading of Openg toolkits can be downloaded with VI Package Manager by JKISoft which is a excelent piece of software. It shows how a LV software could look like.

Ton

Link to comment

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.

×
×
  • Create New...

Important Information

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