5 Hidden LabVIEW Features

Friday, May 9, 2014

In LabVIEW R&D, there’s a lot that goes into creating LabVIEW features. The process includes specification documents, design reviews, code reviews, automated test plans, manual test plans, documentation, and more. When we’re done, we have a feature that is documented, tested, marketed, and officially supported.


But what about all those features that, for whatever reason, don’t get that level of attention? Maybe a feature is written just for an internal team at NI. Or maybe a developer didn’t have enough time to dot all the ‘i’s and cross all the ‘t’s on a really useful API. What happens to all of those features?


They get included in the vi.lib folder, of course! Most of the VIs you can drop from Quick Drop or the palettes live in your [LabVIEW 20xx]\vi.lib folder. But many other VIs that are not “official” LabVIEW features are available in this folder as well.


To learn more about some of these unofficial libraries that are already included with your installation of LabVIEW, join the Hidden Gems in vi.lib community group on ni.com. This group includes a presentation given by Darren Nattinger, Principal Engineer in LabVIEW R&D, discussing many of the Hidden Gems VIs that he uses on a regular basis. Some of his favorite libraries include:


1. VariantDataType VIsvi.lib\Utility\VariantDataType
These VIs allow you to parse variant data to learn more about the specific data type contained within the variant. For example, here is a VI that uses the VariantDataType VIs to determine the strings used to define an enum:

And here is a VI that uses the VariantDataType VIs to determine whether or not a variant is an error cluster:


2. AdvancedString VIsvi.lib\AdvancedString
These VIs perform advanced string manipulation. One of the most useful VIs in this folder is Match 1D String Array.vi, which searches the elements of a string array for one that matches a user-specified pattern. It’s basically like the
Search 1D Array function, but much more useful when dealing with string arrays:


3. Libraryn VIsvi.lib\Utility\libraryn.llb
These VIs perform myriad File I/O operations, including operations on LLBs and files inside of LLBs. Several of the VIs in this library are officially supported and included in Quick Drop and the palettes. But there are many other “unofficial” VIs in this library that are useful as well. For example, Create Directory Recursive.vi will create a folder on disk, and any parent folders that don’t exist:

Another useful VI, Is Name Multiplatform.vi, will test a string to see if it can be used as a file name on the specified file system:


4. _analyzerutils.llb VIsvi.lib\addons\analyzer\_analyzerutils.llb
These VIs are a random assortment of useful VI Server and VI Scripting VIs. They are used extensively by the VI Analyzer Toolkit, but they are also generally useful for other scripting applications. Check out
this page on the VI Analyzer Enthusiasts group on ni.com for a detailed description of many of the VIs in this library.

5. lvconfig.llb VIsresource\dialog\lvconfig.llb
Ok, this last one doesn’t live in vi.lib, but it’s still really useful! Located in your [LabVIEW 20xx]\resource\dialog folder, the VIs in lvconfig.llb allow you to read and write tokens in your LabVIEW INI file, regardless of what platform you’re using, and where the file is located. One potential use case for these VIs involves programmatically updating your LabVIEW preferences settings (i.e. the settings in Tools > Options), perhaps as part of an automated install of LabVIEW.


These are just a few of the many hidden gems readily available in your LabVIEW folder. So check out the Hidden Gems in vi.lib community group to learn more about all these great libraries and utilities that you already have access to in your LabVIEW installation. You don’t want to end up writing a really useful VI only to find out it was already in VI.lib!