Jump to content

TDMS properties get only variant


Recommended Posts

Hi,

the legacy code I'm working on used to have lots of wires running wild between a control reference from the front panel to what ever logic in the BD or just in order to be saved into an xml file.

I'm trying to separate my GUI layer and my logic layer by using a class control that holds the current state allowing the logic to change it and for the GUI to update from it (a GUI change sends a command to the logic that changes the control from where the GUI updates.

However, now that I want to save/load my control state from a TDMS file I found that it is not as easy as it once was with the xml files.

I turned to the OpenG TDMS blocks which helped a lot yet it appears I can't enter a data type outside of the Variant limits and cast it back according to the cluster I have.

In any case it turned out to be much harder than I thought it should be.

Moreover, it is frustrating that I can see a Variant indicator with the data I want and can parse yet with no option to correctly flatten it into string.

Am I missing something? Do you guys know of an elegant way to save a cluster into a TDMS file and then load it's values back into the vi?

P.S. - I attached a jpg with some initial ways I took to solve this issue.

Thanks in advance,

Dror.

post-19007-0-33361200-1309646843_thumb.j

Link to comment

One thing you need to take care of is that TDMS properties cannot contain cluster or arrays. So if your cluster contains a sub-cluster or Array you'll need to worry about that.

You can get inspiration from the the OpenG INI-tools to see how you can detect (and expand) those data-types. Especially with the possibility of recursive VIs it's quite easy to build such a generic tool.

Ton

Link to comment

One thing you need to take care of is that TDMS properties cannot contain cluster or arrays. So if your cluster contains a sub-cluster or Array you'll need to worry about that.

You can get inspiration from the the OpenG INI-tools to see how you can detect (and expand) those data-types. Especially with the possibility of recursive VIs it's quite easy to build such a generic tool.

Ton

Hi Tom,

It is good to know that TDMS properties can't contain sub arrays or clusters. However, in my case I tried to convert a cluster of simple booleans, strings and doubles (Variant seems to have a problem even with paths).

Saving a cluster into an ini/xml/LVM file is so easy yet I don't want to use any text based file and TDMS makes it hard both since it works with Variants and since it can't handle sub arrays/clusters.

After some more testing I think I miss understood some blocks from OpenG. The VData array of values behaves differently than I expected.

Is there a way to use LVM files, for example, yet making them password protected? I simply don't want the user to be able to see/change the parameters files by hand.

I want to save the last state of the control for the next time I run the program. I could have updated the control with the new values and turned them to be default yet since the program runs from an install those settings won't be saved for the next run, thus, I need to save them in a file outside of the installation.

Dror.

Link to comment

If you just want to save and load the values from controls, you can find a simple example here - https://decibel.ni.com/content/docs/DOC-15349

That example flattens the values, so it's unlikely the users would touch them, but you can also use the OpenG VIs and simply place the files where the users don't look. This should usually be enough to protect from users touching them.

Link to comment

If you just want to save and load the values from controls, you can find a simple example here - https://decibel.ni.c.../docs/DOC-15349

That example flattens the values, so it's unlikely the users would touch them, but you can also use the OpenG VIs and simply place the files where the users don't look. This should usually be enough to protect from users touching them.

The link is cool since it handles many users which I totally forgot.

I guess I'll work with it along LVM files.

However, I still don't get TDMS/Variant enough and wish I could use a single binary file like TDMS to save my entire data (both scans and parameters).

Thanks Yair.

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.