LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Darren's Occasional Nugget 03/25/2014

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):

 

checkerrclust.png

 

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:

 

vartodata.png

  

Another great use case for these VIs is programmatically retrieving, at runtime, the names of enum entries as a string array:

 

enum.png

 

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?

 

Message 1 of 12
(12,981 Views)

Enum to string array, nice.  Is there a slide deck that you are able to post?


Certified LabVIEW Architect
TestScript: Free Python/LabVIEW Connector

One global to rule them all,
One double-click to find them,
One interface to bring them all
and in the panel bind them.
0 Kudos
Message 2 of 12
(12,941 Views)

Yup, you can get the presentation here.

Message 3 of 12
(12,937 Views)

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

CLED (2016)
0 Kudos
Message 4 of 12
(12,831 Views)

Hi, I used to download MGI toolkit from VIPM and it has a palette for all the variant type stuff.

0 Kudos
Message 5 of 12
(12,822 Views)

Darren,

that  was a great presentation at the summit in CERN.

 

Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 6 of 12
(12,763 Views)

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

 

 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 7 of 12
(12,746 Views)

@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.

0 Kudos
Message 8 of 12
(12,668 Views)

@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

 

 


  1. Tools>>Advanced>>Edit Palatte set...(drink Coffee)
  2. Right click an open palatte position Insert>>Subpalatte:  
  3. Check Link to a directory    
  4. Browse to <LabVIEW> \vi.lib\Utility\VariantDataType
  5. Select Save
  6. select Continue

Whoomp! There it is:

Capture.PNG

Cross-Posted to uNuggets Thread since this comes up WAY TOO OFTEN.


"Should be" isn't "Is" -Jay
Message 9 of 12
(12,648 Views)

@JÞB wrote:
  1. Tools>>Advanced>>Edit Palatte set...(drink Coffee)
  2. Right click an open palatte position Insert>>Subpalatte:  
  3. Check Link to a directory    
  4. Browse to <LabVIEW> \vi.lib\Utility\VariantDataType
  5. Select Save
  6. 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.

Message 10 of 12
(12,627 Views)