Jump to content

Saving a class with array of waveform reloads corrupted


Recommended Posts

Hey everyone,

 

I am working on a backup function for a test executive.  The backup uses the 'class to XML' vi to create an XML string and then save it to a file to be reloaded later. All of my test specific information lives in the class (or one of it's children).  I like this functionality because it makes backup and reload brainless.  It just works.... until now... I've got a test class for my current tester that's grown rather large.  Everything works fine, until the tester loads some waveform data into either of the waveform arrays.  Without data in this field the class reloads just fine, otherwise if fails and says the XML is corrupted.

 

As you can see in my backup vi I have built in a work around that flattens the waveform arrays to strings, drops them back into the class private data, deletes the waveform arrays and then writes the class.  This works! Much to my surprise both waveform data and the rest of the class data are written to file and reloaded without error.  

 

Does anyone have any knowledge or experience with this? 

 

Cheers,

 

Tim

BackupImage.PNG

WaveformClassdata.PNG

Edited by A Scottish moose
Link to comment

Not specifically, but it doesn't surprise me. Classes are buggy. Flattening variants is buggy. Flattening variants inside of a class...probably buggy :)

I don't have a good answer for how to fix it either, except to say that if I know a class needs to be saved I'll always make a to/from string (or to/from config cluster) and save stuff more manually. I use dr's json lib these days.

Link to comment

I remeber having similar problem when I flattened waveform on RT and then unflattened on Windows. The RT version of waveform did not contain varian with attributes, and Windows version expected this variant. Check your datatypes, something like that is easy to miss.

Edited by PiDi
  • Like 1
Link to comment
15 hours ago, smithd said:

Not specifically, but it doesn't surprise me. Classes are buggy. Flattening variants is buggy. Flattening variants inside of a class...probably buggy :)

I don't have a good answer for how to fix it either, except to say that if I know a class needs to be saved I'll always make a to/from string (or to/from config cluster) and save stuff more manually. I use dr's json lib these days.

I might start looking into more JSON based solutions.  Thanks for the tip

Link to comment

There is a bug with variant attributes with this method on all targets I believe. I've had this issue where the attributes don't get flattened.

I've also had other unknown issues with these methods as well so I tend to avoid then and follow smithd's advice - using JSON or similar to have some more control over the process.

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.