LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read cluster from XML-file with partially changed data

Solved!
Go to solution

Hello together,

I want to save my Cluster-Array (simple example see attached) for example as XML-File.

 

Problem: if I change something in any sub-cluster (add/remove data) I can´t restore my configuration from XML-file.

 

Is there any possibility to do it yet? Actually I take all element-values by property-node and save the array ("ClusterarrayVorÄnderung") as XML-file. But after changes ("ClusterarrayNachÄnderung") its not readable.
Can I compare element by element. If its available, then read, if not, jump. If there is an additional element inside, then jump.

 

Thanks for help...

0 Kudos
Message 1 of 7
(1,169 Views)

Hi Tanchris,

 

you need to keep track of your changes to the cluster definition! Or put it in other words: when converting from XML back to your cluster the datatype definition of the XML has to fit to the cluster…

 

You may go like this:

  1. try loading the XML with your current cluster typedef.
  2. when step 1 fails try with the previous typedef and convert cluster data to current typedef
  3. when step 2 fails try again with even older typedefinition…

 

(AFAIK when you use classes LabVIEW will keep track of datatype change for you…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(1,142 Views)

Thanks GerdW,

 

very nice idea...like everytime from the knight 🙂 The data are changing not very often, but from time to time. Thats why I hoped, there is a way like that:

 

Open "old" definition XML-file --> readout xml-block by block --> look into new definition if there are fitting elements --> write element-data if find/jump if not...

 

Or perhaps there is a better way to save this kind of data, if there are often changes...?

 

The last sentence I don´t understand...

 

Tanchris

 

 

0 Kudos
Message 3 of 7
(1,133 Views)

Hi Tanchris,

 


@Tanchris wrote:

Or perhaps there is a better way to save this kind of data, if there are often changes...?

 

The last sentence I don´t understand...


Sure you can implement your own routines to handle your configuration files. Using INI files might allow you to handle missing/new keys more easily…

 

On the "last sentence": when you store your data in OOP objects LabVIEW will keep track of the version history of those objects. This will also allow you to load older versions of that object using more recent methods of that class…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(1,122 Views)
Solution
Accepted by topic author Tanchris

You just need to use a Library that naturally handles such changes without issue.  There are many such libraries; if you can use JSON instead of XML, my library is JSONtext.

0 Kudos
Message 5 of 7
(1,101 Views)

Thanks for the suggestion... I´ll try it.

0 Kudos
Message 6 of 7
(1,088 Views)

Hi,

 

the JSONtext-toolkit works fine. I`ve only used the basic-features. For tree-structures I wrote all informations in a cluster a save this one to JSON.

 

Thanks all for help...!!!

0 Kudos
Message 7 of 7
(1,043 Views)