LV2103, Win7
Old hand at LabVIEW, brand new to DIAdem.
I need to convert a structure of arbitrary complexity into properties, suitable for writing to a TDMS file, in such a way as to be retrievable, and (hopefully) to be human-readable, such as whn the file is loaded into DIAdem.
I have most of it working just fine, but I have trouble with ENUMs.
An ENUM can be converted to a VARIANT just fine, but writing that variant to a file produces error -68007.
A simple test shows this:
![Snag.PNG Snag.PNG]()
The encoding process is fairly simple - given a generic control Ref, just look at its CLASS ID.
If the ID is one of the basic ones, just get its value as a variant, and append to the NAME and PROPERTY arrays:
![Encode 1.PNG Encode 1.PNG]()
If the item is a CLUSTER, then just get the controls within it, and do them one by one:
![Encode 2.PNG Encode 2.PNG]()
If the control is an ARRAY, then it's a bit more trouble. Since there is no way to get a reference to an arbitrary reference, you have to use the one reference to an element that you have. To use that, you have to be showing one and only one element. So this code does that, while restoring the original view:
![Encode 3.PNG Encode 3.PNG]()
HOWEVER
The ENUM, as I said earler, converts to VARIANT just fine, but TDMS will not accept it.
Here's one technique that works, sort of:
![Encode 4.PNG Encode 4.PNG]()
By converting the enum to an I32, you get the numeric value of its current setting, and can put that into a variant.
When reading, the numeric value will set the ENUM control correctly, so that's good.
The trouble is, in DIAdem, the property will look like:
Whatever_Engine_Cycle 2
While that is true, and will read back OK, it doesn't tell the user what kind of cycle it was.
The point of ENUMS was to put names on specific numbers.
I tried converting the variant to a STRING instead of an I32, but error 1057 (IIRC) happens: "cannot convert variant to specified type".
A similar issue exists for TEXT RING controls - although they will go through the process without error, what shows up is a number.
Any ideas for making DIAdem display the ENUM's string value, instead of a number?
The error says "not recognized by this version of LabVIEW" - is LV2015 any smarter about this?