Jump to content

Data Type code and variant Value


PaulL

Recommended Posts

I have the vague notion that I've seen a solution for this somewhere, but I can't find it. In any case, I think it deserves its own topic.

Sometimes LabVIEW provides a Data Type code and the data Value as a variant. (In particular, this information appears in the Event Data Node for shared variable events.) With this information, one can in principle cast the data back to its original form, but the Variant To Data function does not support the Data Type code, nor does any LabVIEW function (as far as I know). This very definitely should be a native LabVIEW function (at least supporting the native types). (Otherwise, what good is the Data Type code?) Maybe LabVIEW already has this, but I haven't been able to (re)find it.

Link to comment

LabVIEW doesn't have this. You need to know the data type at *edit time* because the Variant to Data primitive needs to output a wire of a specific type if you're to use it.

IF memory serves, the type descriptor is used (or at least used to be) when you unflatten from a string, presumably because the flattened data does not keep all the subtleties of the data type, but I may be remembering incorrectly.

Link to comment

IF memory serves, the type descriptor is used (or at least used to be) when you unflatten from a string, presumably because the flattened data does not keep all the subtleties of the data type, but I may be remembering incorrectly.

Yes the flattened data only contains the actual variant part of a control and not its invariant data type information at all.

The Unflatten from String did not really take a type descriptor as it also needed to know the final data type at edit time. The Flattened String to Variant does take such an input but the entire type descriptor business got internally completely redesigned with LabVIEW 8 to avoid the problem of the 16 bit size limit for old style type descriptors and NI decided at that point that they are not going to expose the new 32 bit safe type descriptors to the LabVIEW diagram in any way.

The old 16 bit type descriptors are still exposed since they are used in the OpenG Variant tools and many other projects but do crash on type descriptors exceeding the 16 Bit size limit.

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.