LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read class from file problem

Solved!
Go to solution

I have written an application that save data into file as labview class. The class consist of array of waveforms and other classes. When I want to read data from the file I get the error 1527 "Attempted to read flattened data of a LabVIEW class that is not currently loaded into LabVIEW".

I tried to remove class from library, because I found on forums that this might be the cause of the problem, but it isn't help. Then I put class back to the library and now I get the error "End of file encountered".

I have no idea what am I doing wrong, because I have used the same approach several times and it worked fine.

Is there any other way to read data from the file? For example, if I would know how the array of waveforms is saved in binary file I could parse data from file.

I have Labview 2011.

 

 

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

I'm guessing this happens because the class lost its mutation history, so it doesn't know how to load the old data. Things which could cause this are renaming the class and moving it into or out of a library (as you've found). Moving it back does not bring back the mutation history and the only option is to go back to an old version of the class (if you have source code control).

 

Here are some relevant links, including descriptions of how flat data is saved, in no particular order:

 

  1. http://lavag.org/topic/14548-class-mutation-history
  2. http://zone.ni.com/devzone/cda/tut/p/id/6316
  3. http://lavag.org/topic/13441-unflatten-from-string-on-class-error-1527
  4. http://labviewwiki.org/LVClass_Data_Storage_Format
  5. http://digital.ni.com/public.nsf/allkb/103A235CD004CF5B862577E400752398
  6. http://zone.ni.com/reference/en-XX/help/371361H-01/lvconcepts/flattened_data/
  7. http://lavag.org/topic/9705-behaviour-when-loading-class-data-from-a-flat-binary-file

___________________
Try to take over the world!
0 Kudos
Message 2 of 5
(2,289 Views)

TST, thank you for your effort.

I have source code control, but something must have gone wrong because I am not able to open the file with any revision.

I know the exact format of the file, because it didn't change for a while now.

Is there any possibility to read data from the file if I recreate the class, knowing its exact format? If not, them I'm stuck with reading flat data from the file.

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

One additional question. Does NI provide binary file parser in any form? That would help a lot.

0 Kudos
Message 4 of 5
(2,284 Views)

A parser for binary data is meaningless unless you either know the format of the data or the file has meta data to desribe that format.

 

As for whether or not you can recreate the class and have it work, my understanding is that LV uses the fully qualified name of the class (that is its name along with all the libraries which contain it) to determine whether the object is of the correct class and then checks the version of the object and applies the transformation. Presumably, if you manage to recreate all the conditions, loading the object would work, but that's just a guess. You can look at those other links for more details.


___________________
Try to take over the world!
0 Kudos
Message 5 of 5
(2,260 Views)