LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Flatten object to XML doesn't work with default values in class fields

Solved!
Go to solution

wiebe@CARYA wrote:

 

And of course, that To XML method would face the same problem. As a workaround, 'flattening' the private data must be done by unbundling each item. That is error prone (and a bit annoying): if one item is added it's easy to forget to extend the To XML method.

 


You should consider clustering the data you want flattened (all the object data if you want).   Then flatten that cluster in your method.  That way, adding new items to the cluster requires no change to the flattening code.  My "actors" use similar techniques (although their data is in a VI, rather than in an object) so I rarely need to change any flattening code.  

0 Kudos
Message 11 of 14
(731 Views)

@drjdpowell wrote:

wiebe@CARYA wrote:

 

And of course, that To XML method would face the same problem. As a workaround, 'flattening' the private data must be done by unbundling each item. That is error prone (and a bit annoying): if one item is added it's easy to forget to extend the To XML method.

 


You should consider clustering the data you want flattened (all the object data if you want).   Then flatten that cluster in your method.  That way, adding new items to the cluster requires no change to the flattening code.  My "actors" use similar techniques (although their data is in a VI, rather than in an object) so I rarely need to change any flattening code.  


I really don't want two in placement structures to unbundle\bundle my data.

 

Can't really say I've run into this a lot, and there are workarounds, and arguably you shouldn't really need it that often. I still think the hole matter of the default class\clusters just seems off.

 

AFAIC, bottom line is the results it's not expected nor properly documented.

0 Kudos
Message 12 of 14
(724 Views)

wiebe@CARYA wrote:

@drjdpowell

I really don't want two in placement structures to unbundle\bundle my data.

 


Why would you need that?  Unbundling into subclusters doesn't require multiple steps.  There is no extra work involved.

0 Kudos
Message 13 of 14
(721 Views)

@drjdpowell wrote:

wiebe@CARYA wrote:

@drjdpowell

I really don't want two in placement structures to unbundle\bundle my data.

 


Why would you need that?  Unbundling into subclusters doesn't require multiple steps.  There is no extra work involved.


You're right, never mind that. Almost weekend.

0 Kudos
Message 14 of 14
(716 Views)