NI Home > Community > NI Discussion Forums

LabVIEW

Showing results for 
Search instead for 
Do you mean 
Reply
Trusted Enthusiast
Darren
Posts: 2,905

Darren's Weekly Nugget 04/13/2009

In LabVIEW 8.6, I included a set of VIs in vi.lib\UserTags for assigning tags to objects in your VIs (or to VIs themselves).  Tags are basically just name/value pairs that you can assign to any VI or any object in a VI.  Tag names/values are persisted when you save the VI after assigning a tag.  There are several possible use cases for tags, here are just a few:

 

  • Marking certain VIs with tags so they can be easily identified by plug-in frameworks.  For example I could assign a certain tag to VI Analyzer test VIs so that the VI Analyzer would not load any test VI that did not have this custom tag set.
  • Including configuration information for controls/indicators on custom UIs to avoid having to synchronize with a separate database.  When I worked on the Simulation Interface Toolkit many years ago, I stored model parameter mapping information for front panel controls/indicators as tags in the controls/indicators themselves.  That way, if you renamed or deleted a front panel item, I wouldn't have to go searching in a separate database to figure out which object needed renaming or deletion...the parameter mapping information simply stuck around with the renamed control (or disappeared along with the deleted control).
  • Assigning unique identifiers to front panel decorations.  This use case was discussed in this thread.


Prior to LabVIEW 8.6, tags were only available with private VI Server methods...in fact, the VIs in vi.lib\UserTags wrap these private methods, with a few caveats attached:

 

  •  You cannot store refnum or LabVIEW Class data in a tag.
  •  Internally, I append "user." to the beginning of any tag name set by these VIs.  That way, we can be sure that user tags do not generate name conflicts with any existing internal NI tags that may already be set on VIs or objects.

What other use cases are out there for VI/object tags?
Darren Nattinger, CLA
LabVIEW Artisan and Nugget Penman
Knight of NI
Knight of NI
tst
Posts: 10,924

Re: Darren's Weekly Nugget 04/13/2009

Some quick ideas:

I posted a quick example here which demonstrated attaching size info to controls, so that you could do proper dynamic resizing of the front panel. Of course, a full framework for something like this would require a lot more work.

 You could save preset values for controls with the controls themselves (e.g. different default values).

If you had access to the block diagram hierarchy of objects, you could mark all kinds of structures.


___________________
Try to take over the world!
Active Participant
F._Schubert
Posts: 1,534
0 Kudos

Re: Darren's Weekly Nugget 04/13/2009

Are the Tag-Vis working on the runtime engine? Are they saved with the VI?

 

And for use-cases: I would use tags for any kind of testing/analyzing/validating VIs, including a revision number/checksum (such as individually excluding from some test scenarios, or not performing checks again to save time).  But that would require a severe bunch of private functionality, at least in some most cases.

 

Felix

www.aescusoft.de
My latest community nugget on producer/consumer design
My current blog: A journey through uml
Active Participant Pnt
Active Participant
Pnt
Posts: 757

Re: Darren's Weekly Nugget 04/13/2009

Shouldn't tags be a property node (or invoke) ?

So it would be easier to use.

 

They are a very nice feature !

Active Participant
F._Schubert
Posts: 1,534
0 Kudos

Re: Darren's Weekly Nugget 04/13/2009

Pnt: I guess in fact they are nothing else than property nodes. We end users just can't see them, as they are private to NI R&D.

And why? That's clearly explained in Darrens post. Some tools of our IDE use these Tags, and marking ours as 'user' inside the wrapper VI will prevent that we mess things up. Clearly shows why we should not play with private functionality.

Or should we during our easter holiday...

 

Felix

www.aescusoft.de
My latest community nugget on producer/consumer design
My current blog: A journey through uml
Trusted Enthusiast
Darren
Posts: 2,905
0 Kudos

Re: Darren's Weekly Nugget 04/13/2009

Tags have been around for a while, and yes, they are simply private methods that I call within those wrapper VIs.  Originally, I wanted to make them public methods.  After shopping the idea around LabVIEW R&D, I received two big objections to this.  First, the methods don't work so well with refnum and LV Class data.  Second, they might be used to mess with internal NI tags that we set on VIs/objects.  Thus, I wrapped the methods in VIs, and added code to avoid these two situations (as you can see from the caveats in my initial post).
Darren Nattinger, CLA
LabVIEW Artisan and Nugget Penman
Knight of NI
Knight of NI
tst
Posts: 10,924

Re: Darren's Weekly Nugget 04/13/2009

You can also use tags to attach information (e.g. creator, version, etc.) to a VI and then use that with various automated tools (SCC, builders, etc.).

___________________
Try to take over the world!
Knight of NI
Ray.R
Posts: 10,586

Re: Darren's Weekly Nugget 04/13/2009


Darren wrote:

In LabVIEW 8.6, I included a set of VIs in vi.lib\UserTags for assigning tags to objects in your VIs (or to VIs themselves). 



Let's see if I understood correctly.  The tags are assigned to objects within the VI and not to the VI itself.  Each object within the VI can have one or more tags assigned to it.

 

How would someone access these from outside LabVIEW?

 

R

______________________________________________________________________
Kudos!!!! Gimme Kudos!!!! It's that little golden star on the left below my avatar... :smileyhappy:
Knight of NI
Knight of NI
tst
Posts: 10,924
0 Kudos

Re: Darren's Weekly Nugget 04/13/2009

Tags can be assigned to any object in the Generic class hierarchy (which includes FP objects and BD objects), but also to VIs.

 

As for accessing it externally, since the methods are private, I assume you can't see them in the ActiveX hierarchy and would have to use a wrapper VI to get and return the information (Command line arguments are probably the simplest, but I'm not sure how you would be able to return the info. You might need to implement the VI as a DLL function).


___________________
Try to take over the world!
Active Participant
crelf
Posts: 1,485
0 Kudos

Re: Darren's Weekly Nugget 04/13/2009


Darren wrote:

In LabVIEW 8.6, I included a set of VIs in vi.lib\UserTags for assigning tags to objects in your VIs (or to VIs themselves).


I've always used the private scripting nodes to use tags - any chance of the VIs in the new folder appearing in the standard palettes in LabVIEW 2009?





Copyright © 2004-2014 Christopher G. Relf. Some Rights Reserved. This posting is licensed under a Creative Commons Attribution 2.5 License.