From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Flatten to XML error

I'm having an odd error with the Flattent to XML function. I am using it to save a settings type definition for a data acquisition VI I made.  It works beautifully almost all the time until now.  I built a calibration routine that calculates the slope and intercept for my torque measurement using the lineear fit.vi and automatically puts the calculated slope and intercept into the settings type def then saves it. However when I try and save the type definition the Flatten to XML throws an improper input error.  If I just type the same value in and save it works fine.  I can't seem to wrap my head around why I'm getting this error.  Is the linear fit vi not outputting the data as a double?  Why would saving the settings type def with the slope and intercept inserted into the cluster cause an error when manually typing it in does not?

 

Thanks for any help,

Richard 

Download All
0 Kudos
Message 1 of 4
(2,809 Views)

Hi!

Is the path provided by "Create XML Path.vi" ok?

 

Can you provide an example of an output string of the "flatten to xml.vi" giving problems when saved?

 

Regards,

Marco

0 Kudos
Message 2 of 4
(2,700 Views)

The file path is good as it does not change depending on the method used to save (Code to get the filepath is below). As for the output I'm not sure exactly what your asking for, just a copy of the XML document after the error? Unfortunately I don't have a copy handy.  On the plus side I found a work around though why it works is beyond me.  Before when the code saved the settings to XML directly after the calibration routine calculated the values it caused the error, but I I allow the program to run a few loop iterations with the new values in the settings type definition it saves with no error.  So now the program just loads the new values to the settings type definition and then waits for the user to hit a save button (thats there already for when they make manual changes) and it works.    I can't wrap my head around WHY it works as it seems to be saving the exact same information but there you go.

  XML Save Snippet.png

0 Kudos
Message 3 of 4
(2,666 Views)

Hi!

If the error is being generated by the Write to XML file.vi, I just wanted to check the velues of the two provided parameters

1) The path (..that seems to be ok)

2) The XML string generated by the Flatten to XML.vi. (This was the string I was asking for 🙂

Try to grab the value of the string when you have an error and check if there's something strange (I suspect you already this, though)

 

 

Is it possible that the file is being opened at the same time by another process/program?

 

Regards,

Marco

0 Kudos
Message 4 of 4
(2,625 Views)