09-10-2009 10:14 AM
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.
Solved! Go to Solution.
09-11-2009 03:00 AM
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
09-11-2009 03:38 AM
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.
09-11-2009 05:23 AM
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.
09-11-2009 06:12 AM
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.
09-11-2009 09:50 AM
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.
09-11-2009 09:57 AM
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