LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get a SubVI Reference w/o using Open VI Reference

Solved!
Go to solution

Is there a way to create a VI Reference without specifying the folder/file path to the Open VI Refrence VI?  I would have thought I could right-click a subVI in a diagram and goto Create->Reference similar to controls and indicators.

 

My only problem with specifying the location is that the name of the VI has to be hard coded into the path.  If ever I change the name of that particular VI I will need to remember to update my string constant.

0 Kudos
Message 1 of 7
(7,506 Views)

Hi Nickerbocker,

can you please explain what you try to do? Why do you need the reference, if you use every time the same vi?

 

Mike

0 Kudos
Message 2 of 7
(7,481 Views)
Solution
Accepted by topic author hecmar.arreola

You can use a static VI reference. I didn't check, but since this is handled like a SubVI it should update the reference if you do a "save as..." of the SubVI from LabVIEW.

 

Message 3 of 7
(7,475 Views)

You can also use a "Strictly Typed VI Reference" combined with the "Call Reference Node" to have both the VI Reference and the VI's inputs and the outputs.

 

Attached, an example.

0 Kudos
Message 4 of 7
(7,463 Views)

Hi Nickerbocker,

 

You don't need to remember string constant. What you can do is, Write your vi name or Path of your vi in a text file. Use INI files to get the name or path  of the vi each time when you will run your code. So you don't need to hard code name of Vi.

So when your VI name is changed you just have to update text file.

I hope I made myself clear. Best of luck. Tell me if you like this solution.

Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved.
0 Kudos
Message 5 of 7
(7,452 Views)

Static VI Reference is what I was looking for.  Thanks for all the input guys!

 

@MikeS81 - I was using the "Open VI Reference" VI to get a reference to my VI.  For that to work I had to connect a control or constant that supplied the name of the VI as well as the path to the VI.  This just seemed to open the door to run-time problems, and potentially problems when compiling an app.  Using the Static VI Reference, and setting the VI in the reference I have the pre-compiler (?) checking for errors and updating the reference if I were to change the name of the VI and it happens to be looking.  If it can't find the VI when I open the file, I will get an error and know where the error is if I try to run it.  If this were handled by a string constant I will probably not get the error, just screwy results when I run the VI.

0 Kudos
Message 6 of 7
(7,421 Views)

FYI:

 

There WAS a bug in staic refs in a built app. So if you suspect the static ref is not working, you may be right.

 

No I don't remeber which version of LV. I do remember I found while answering a Q on the forums so a search may find that thread.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 7
(7,417 Views)