Jump to content

Save and restore clusters. Restore won't know which values are being restored.


Recommended Posts

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

Link to comment

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:

post-2399-020746800 1276802026_thumb.png

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

Link to comment
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

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.