LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Relative path not working for MS office Report- Path to template (Custom Report)

I am getting error while using relative path: custom report template could not be found. 

 

I have 2 folders Executable and Source inside testing folder. VI and project is saved in Source folder(C:\testing\Source). Report template is in executable(C:\testing\Executable).

 

Tried relative paths: ..\Executable\ATP4100171 Test Report.dot   and ..\..\Executable\ATP4100171 Test Report.dot

 

I am able to generate report when I give absolute path. C:\testing\Executable\ATP4100171 Test Report.dot

 

Does MS office report allow relative path. Please help!

 

MMudya_0-1701375424988.png

 

0 Kudos
Message 1 of 5
(653 Views)

Hi MM,

 

what's the problem in creating an absolute path from your executable path?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(617 Views)

This test software will be used by multiple people. They will use .exe. They might have different folder structure

 

It would be better to give relative path

 

I tried path which is relative to my VI. It dint work

0 Kudos
Message 3 of 5
(604 Views)

i have same problem, have u resolve it?

0 Kudos
Message 4 of 5
(302 Views)

Relative paths to what? Most LabVIEW file functions that operate on actual files on disk do not support relative paths because it is usually unclear to what location they should be relative.

But, but there is a Current Directory which points to the directory the current executable is running from.

 

Yes and the concept of a current directory in a multithreading environment is totally flawed. It can and will change frequently. There are APIs to change it at will, the common file dialogs will change it to whatever directory you were in whenever you select a file and the start location when running in the IDE is the LabVIEW installation directory or whatever directory the program shortcut defined.

You as the programmer know best to what location you want it relative, LabVIEW can’t read your mind nor the mind of your software users. Since you know what location you want to reference with your relative path you can always build an absolute path by combining that reference location and your relative path. That way there is no ambiguity. Well you will soon find out there still can be as your users complain it does not use the file they want but if you as creator of your app get problems to determine the correct path, LabVIEW can’t even start to guess the right one.

Rolf Kalbermatter
My Blog
0 Kudos
Message 5 of 5
(292 Views)