george seifert Posted June 17, 2010 Report Share Posted June 17, 2010 I'd like to be able to save and restore data from clusters. The data in each cluster will vary (different control types and number of controls). Saving is the easy part if I use XML. The restoring part is where I'm stuck. I won't know beforehand which controls are to be restored. So I think I need to somehow get the data from the stored values in order to do the restore. Any hints to get me started would be welcome. George Quote Link to comment
Ton Plomp Posted June 17, 2010 Report Share Posted June 17, 2010 I'd like to be able to save and restore data from clusters. The data in each cluster will vary (different control types and number of controls). Saving is the easy part if I use XML. The restoring part is where I'm stuck. I won't know beforehand which controls are to be restored. So I think I need to somehow get the data from the stored values in order to do the restore. Any hints to get me started would be welcome. George What about this little piece of code: The trick is to get the controls-data in a cluster where each element has the name of the specific control. You can use the OpenG Variant toolkit VIs to build the cluster. Ton Quote Link to comment
Dragoon235 Posted June 17, 2010 Report Share Posted June 17, 2010 The data in each cluster will vary (different control types and number of controls) It's important to note that clusters are not dynamic. They are similar to struct's in C/C++. For example, an out port on a case statement; you cannot wire a cluster of two booleans and a cluster of a boolean and a numeric to the same port. You will get a broken wire. They are different types. Variant datatypes store the data as well as the metadata for interpretation of said data. Flattened strings can also be used for this purpose, but they require a little more management by the programmer. Here is a good article on variants and flattened strings from NI's Website: NI on Variants Quote Link to comment
george seifert Posted June 17, 2010 Author Report Share Posted June 17, 2010 I found some old code that I think will work. It saves and restores flattened data. The control name is stored so it knows where to restore it to. Thanks for the suggestions. George Quote Link to comment
Omar Mussa Posted June 17, 2010 Report Share Posted June 17, 2010 Shameless plug - you could also just use the JKI EasyXML toolkit for this. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.