LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

vi self reference

I want to have a self reference for a VI so that I can display some history data on the front panel.  The only way I've been able to do this is using the open VI Reference vi with the name of the VI.  This does not work if someone changes the name of the vi which is often done in our setting to specify, for example, a version that has a desired set of default parameters.  I've not been able to locate a constant such as "this" or "self". 
 
How do I get this->history?
 
Robert
 
0 Kudos
Message 1 of 8
(4,878 Views)

You can get the name of the VI by placing a property node on the diagram, right clicking it and selecting Select Class>>VI Server>>VI and then selecting the VI Name property which you can wire into the Open VI Reference VI. You can also get to the VI class by wiring the output from an Open VI Ref into a property node and then disconnecting it.

You should note that since a property node set to the VI class defaults automatically to the current VI you shouldn't have a reason to use Open VI Ref unless it would sometimes be the current VIs and other times other VIs.


___________________
Try to take over the world!
0 Kudos
Message 2 of 8
(4,863 Views)

From your description, I think you want "Current VI's path"

Rod.

 

0 Kudos
Message 3 of 8
(4,861 Views)

Hi Robert,

One way is using the "Current VI's Path" constant under File I/O -> File Constants. Use that as an input to open vi reference, and you can get the history from that reference.

Regards

//Martin



CLA
https://www.prevas.se/expertis/test--regulatoriska-krav.html
0 Kudos
Message 4 of 8
(4,860 Views)
On the File I/O>File Constants palette is the Current VI's Path function but you don't need to use the Open VI Reference at all. If you just have a property or invoke node, they will default to the current VI.
0 Kudos
Message 5 of 8
(4,859 Views)
All great suggestions. An unwired VI class property node is the best answer, but if you want to be as explicit as possible in the code, LabVIEW 8 adds a This VI class constant in the Applications Control palette that you can wire into the property node. It also doubles as a This Application reference if you click on it and switch it.

Message Edited by Jarrod S. on 08-15-2006 10:51 AM

Jarrod S.
National Instruments
0 Kudos
Message 6 of 8
(4,853 Views)

Thanks for all the responses.  I'm using 7.1 so won't be able to use the very welcome "this VI" constant.  Using an unwired property node is obviously (now) the way to go.

 

Robert

0 Kudos
Message 7 of 8
(4,832 Views)

One thing to note about the Current VI's Path primitive is that it will only work if the VI has been saved.

Another option (besides the VI Name property) is to use the Call Chain primitive with a and index the second element.


___________________
Try to take over the world!
0 Kudos
Message 8 of 8
(4,805 Views)