LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I specify relative SubVI file path in VIs?

Solved!
Go to solution

I use LabVIEW 2009 Service Pack 1.

 

SubVIs are referenced by absolute paths, so when I move them to a new folder I may need to set their paths again.

 

How can I make a SubVI reference a relative path so that I don't have to set its path after moving VIs to a new folder or a new drive?

0 Kudos
Message 1 of 13
(4,847 Views)

You can use the static vi reference or if you have a defined folder structure you can always refer from the vi where you are giving the path and strip and build accordingly.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 13
(4,834 Views)
Solution
Accepted by topic author iCat

I believe that SubVIs are internally referenced by relative paths. Once you move the entire project to a new place, it should find everything in the new relative paths.

Where did you encounter any problems?

0 Kudos
Message 3 of 13
(4,826 Views)

@altenbach wrote:

[...]Where did you encounter any problems?


From my experience, most of those problems occur when moving VI files directly on disk (Windows File Explorer) individually.

 

@Op:

Altenbach brought up a good point: When moving/copying the project, take care that all project related sources are within a single project folder. Move/copy the whole project folder, keeping its internal setup. In most cases, that is doing fine.

When moving individual files (VIs), make sure that you use the LV Project Explorer to do so. Add all files used in the project into a single lvproj and then swap to the "Files" tab. Rightclick the individual VI you want to move and select "Move on Disk" from the context menu. This will auto-update all (known) callers as well.

 

hope this helps,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 13
(4,820 Views)

SInce he said he wanted to specify relative paths, I assumed that he kept the relative hierarchy intact so there should not be anything else needed. Who knows? 😄

0 Kudos
Message 5 of 13
(4,817 Views)

My boss told me there had been dialogs that prompted for SubVI paths after moving the entire folder to another location by Windows Explorer.

 

There had been such dialogs according to my boss, but I have to investigate to know if it is true.

0 Kudos
Message 6 of 13
(4,786 Views)

Those dialog box will come only when you are calling the vi directly by creating an instance but when you are calling the vi by using its absolute path (Dynamicall) you won't get any.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 7 of 13
(4,774 Views)

What do you mean by "Those dialog box will come only when you are calling the vi directly by creating an instance"?

 

By creating an instace of what?

0 Kudos
Message 8 of 13
(4,770 Views)

@iCat wrote:

What do you mean by "Those dialog box will come only when you are calling the vi directly by creating an instance"?

 

By creating an instace of what?


In a block diagram when you pull a sub vi into a main vi that is called the Instance of the sub vi. So when you replace the sub vi in some other place and when you open the main vi where the sub vi is called it will search for the vi since it is not found in its original place it will give you a dialog box to select the missing sub vi and then you can browse to the other location where you have kept the sub vi.
-----

The best solution is the one you find it by yourself
0 Kudos
Message 9 of 13
(4,765 Views)

If you are calling VIs dynamically using a path, you can make the path relative to the toplevel VI, for example.

 

We really need to see some code to see what this discussion is all about.

0 Kudos
Message 10 of 13
(4,764 Views)