03-25-2014 03:38 PM - edited 03-25-2014 03:52 PM
I attended the European CLA Summit last week (my first trip outside the USA!). At the summit I gave a presentation that discussed, among other things, the VariantDataType VIs. Among the myriad use cases for these VIs is checking a variant to see if it matches a particular type. For example, we have a VI that ships with LabVIEW that will assess whether or not a variant is an error cluster (for reference, this VI lives in vi.lib\addons\analyzer\_analyzerutils.llb\VIAnUtil Check Type If ErrClust.vi):
In this VI, we check the variant to see (1) if it is a cluster, (2) if it has three elements, and (3) if those elements are Boolean, I32, and String (in order). I have often recommended this approach for type checking over a simple Variant To Data function call, since Variant To Data will attempt the conversion, even if the types don't match exactly:
Another great use case for these VIs is programmatically retrieving, at runtime, the names of enum entries as a string array:
The VariantDataType VIs are great for data type parsing, and these are just two of many use cases that demonstrate the power of this undocumented API. Have you encountered a novel use for the VariantDataType VIs in your applications?
03-25-2014 04:04 PM
Enum to string array, nice. Is there a slide deck that you are able to post?
03-25-2014 04:06 PM
Yup, you can get the presentation here.
03-25-2014 07:46 PM
Can we bring some of these functions into the "officially supported" set?
http://forums.ni.com/t5/LabVIEW/Make-VariantDataType-functions-officially-supported/td-p/2792204
I hope you don't mind I borrowed one of your images
03-25-2014 08:03 PM
Hi, I used to download MGI toolkit from VIPM and it has a palette for all the variant type stuff.
03-26-2014 03:41 AM
Darren,
that was a great presentation at the summit in CERN.
03-26-2014 04:04 AM
Variants are indeed very nice and powerful, i've made a general ini-file writer/reader through that.
It begs the question: Why are the functions hidden? The Variant palette needs fleshing out, if not in the direct palette, then in a "advanced" subpalette.
/Y
03-26-2014 09:14 AM
@juncaofish wrote:
Hi, I used to download MGI toolkit from VIPM and it has a palette for all the variant type stuff.
Same with OpenG which also has a Enum to String or String to Enum. Still I'm in favor of native support over 3rd party when functionality is the same.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
03-26-2014 09:50 AM - edited 03-26-2014 09:52 AM
@Yamaeda wrote:
Variants are indeed very nice and powerful, i've made a general ini-file writer/reader through that.
It begs the question: Why are the functions hidden? The Variant palette needs fleshing out, if not in the direct palette, then in a "advanced" subpalette.
/Y
Whoomp! There it is:
Cross-Posted to uNuggets Thread since this comes up WAY TOO OFTEN.
03-26-2014 10:15 AM - edited 03-26-2014 10:15 AM
@JÞB wrote:
- Tools>>Advanced>>Edit Palatte set...(drink Coffee)
- Right click an open palatte position Insert>>Subpalatte:
- Check Link to a directory
- Browse to <LabVIEW> \vi.lib\Utility\VariantDataType
- Select Save
- select Continue
Whoomp! There it is:
Cross-Posted to uNuggets Thread since this comes up WAY TOO OFTEN.
Not needed just install the package in the Package Network made by NI called Hidden Gems in vi.lib as mentioned at the end of the slides posted by Darren.
Edit: Thank you by the way for making this a package. I already have a vi.lib package with many of the things you mentioned in your slides but not all so this is easier.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord