LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reference current vi

Hello,

I would like what is the best way to obtain the reference of the current vi from inside it. I know there is the method open reference property and it works ok but is there another way to do it without open a reference?

Thanks,

ToNi.
0 Kudos
Message 1 of 11
(8,353 Views)
There really isn't anything that will just give you the reference. You have to use the "Open VI Reference" function.

The best way is shown below. Just use a property node to get the current VIs name and wire it to the Reference function.



Ed

Message Edited by Ed Dickens on 12-25-2005 07:25 AM



Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 2 of 11
(8,352 Views)
I just remembered that in LabVIEW 8, there is a node in the Application Control palette that will give you a reference to the current VI.

When you drop this on the block diagram, it will give a reference to the currnet VI, but can be changed to give a reference to the Application or the Front Panel (called "Pane")





Ed

Message Edited by Ed Dickens on 12-25-2005 08:33 AM



Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Download All
Message 3 of 11
(8,344 Views)


@Ed Dickens wrote:
There really isn't anything that will just give you the reference. You have to use the "Open VI Reference" function.

The best way is shown below. Just use a property node to get the current VIs name and wire it to the Reference function.


Instead of using a property node, you could also use "current VI path". (see case 1)

Even simpler, you can just grab the reference from the property node, (any VI property!) (see case 2) 😉


 

 

Message Edited by altenbach on 12-25-2005 12:29 PM

Message 4 of 11
(8,335 Views)

Hello

 

i'm trying to do this .

but when i place "property node" from :

 

property node2.PNG

 

 

 

and as you see it's application not vi .

how can i have This :

33.PNG

Morteza

Best Regards.

0 Kudos
Message 5 of 11
(7,298 Views)

Right-click the property node and: Select Class... etc. (see picture)

 

 

Then click the property and select "VI Name"

Message 6 of 11
(7,279 Views)

You should also realize this thread is pretty old.  Instead of going to that length, you can hit ctrl+space to see "Quick Drop"  Start typing "This VI" until you see "VI Server Reference" and drop that.  It's much cleaner than creating a random property node to get the same value.

Message 7 of 11
(7,151 Views)

I'm confused -- a decade ago, the original question was asked, and it has just resurfaced.  What is wrong with the simple VI Server Reference (which is conveniently labeled "This VI" with the curved-arrow Reference indicator)?  I tested this snippet as both a "raw VI" and as an Executable -- results were the predicatable and expected -- identical except the Executable had an extra "Prog.Exe" preceding "This VI.vi".

 

Am I missing something?  [Obvious answer -- almost certainly ...]

 

BSVI Server Ref.png

0 Kudos
Message 8 of 11
(7,142 Views)

@Bob_Schor wrote:

Am I missing something?  [Obvious answer -- almost certainly ...]


Well these are all just alternate methods to get a property node linked to the current VI. Any will work. In my last post I answered the very specific question on how to switch from a app ref to a vi ref, nothing more. 😄

 

If all we need is a single VI property node, we don't need a VI reference at all, because the property can be linke implicitely (as I show above). There is also no need to close a static reference.

 

If you take your snippet and delete the static reference and the close operation, you still have the same functionality, but less clutter. 😄

0 Kudos
Message 9 of 11
(7,131 Views)

There's nothing wrong with that answer Bob.  It was even mentioned in the original answers.  It looks like it was a new feature then.  Now, it's old enough it doesn't make sense to use the other option solely to gain the reference.  You'd only want to use the property node if that's what you were trying to change.  At that point, the reference becomes redundant.

0 Kudos
Message 10 of 11
(7,127 Views)