LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving LabVIEW Object Array.

Solved!
Go to solution

Hello All,

 

I have a requirement of saving my LabVIEW Object Array to a file.

 

Here I need to save only the LabVIEW Class Data. I have a Parent class called Device, and under that I have different Child Devices. Initially I thought of saving it as a binary file and its working fine. But if I modify any class ,like add or delete the Property of method of it, The file I saved is not opening .I understand its because of data type mismatch. 

 

Can anyone suggest me what is best method of saving Class array. The array includes the parent class and child classes also.I will be using some of the parent properties in child classes .Also child class is having its own properties too.

 

I thought of using XML or Ini file to Save the Class Data. Section as Class name and Key is the property and Data is the value of the property.

Can programmatic get all the properties of a class and value in it (including the parent class property used ).

 

 

Thank you

 

Vipinraj KK

CLA.png

 

0 Kudos
Message 1 of 5
(2,351 Views)
Solution
Accepted by topic author VipinrajKK

If you use the built-in LabVIEW flatten to XML and unflatten from XML nodes, it's all done automatically.  It's even smart enough to be able to load old versions of the class data somewhat well.  It does an even better job at loading old versions if you use the techniques listed in this article on preserving class data.

Message 2 of 5
(2,333 Views)

Hi,

 

Really thanks for the quick reply.

 

I will check the option and update here.

 

0 Kudos
Message 3 of 5
(2,327 Views)

What error do you receive? Loading old versions of class data should work also from binary file. Adding or removing methods will not change the class flattend private data so it has no reason not to load. Do you have a class holding your array of objects or you build the array before saving? I would create such a class with methods for saving and loading from file. Also, all the classes in the file must be already in memory when loading.

Lucian
CLA
Message 4 of 5
(2,271 Views)

Hi,

 

Thanks for your reply

 

I have a class called device.lvclass and child classes are NI Cards , like PXI6226.lvclass,PXI6259.lvclass and etc.

 

Inside Parent class (Device.lvclass) class I have property called "device array", That is created using LabVIEW base object and I m inserting all the child classes inside that parent Property. I save that device object to a binary file.

 

After modifying any if the classes(Parent or child) if i try to read the old file , its showing the file corrupted error.

 

0 Kudos
Message 5 of 5
(2,267 Views)