LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview- Excel template path at run time(to build .exe file)

I am new to labview and I have one doubt in it. I have one main.vi file where I use local drive path to invoke one excel template, Now I have to convert this .vi file in to .exe file. So now I cannot give the local drive path to invoke the template because the client will not have the same path as mine. So what I did is I created one project. Under this project I created one virtual folder which contains the excel templates. My doubt is how to give path for the excel-template in main.vi file. Please let me know if you guys know. thanks in advance.

    

Thanks & Regards

saamy

0 Kudos
Message 1 of 20
(4,817 Views)

Hi!

 

One way to solve this is to include the excel template when you create the installer. So that it will be saved like this:

 

My program folder

|------------------------->Data folder

|                           |------>Template.xlsx

|My program.exe

 

In your vi you can use this:

a.png

 

With the application folder node, you can easily build the path to the data folder and the excel template. The node will get the path from where the application is installed on the client computer. 

Remember that the template cannot be moved if you choose this strategy.

 

Regards,
Even
_________________________________
Certified LabVIEW Associate Developer

Automated Test Developer
Topro AS
Norway
0 Kudos
Message 2 of 20
(4,812 Views)

Hello Saamy,

 

To create the file path you use the file I/O->File Constant->Current VI Path pallet. So depending on your current file path you can build or strip the path to use the template.

One more thing you have to take care when normally you create a VI If you use these function to finding the path of your template this will work fine, but if you create the EXE the output of the current VI path came different, the output of current VI path in EXE include the application.exe so you have to create path according to your current VI output.

Keep indicator on output path and check in EXE main VI path.

Thanks and Regards
Himanshu Goyal | LabVIEW Engineer- Power System Automation
Values that steer us ahead: Passion | Innovation | Ambition | Diligence | Teamwork
It Only gets BETTER!!!
0 Kudos
Message 3 of 20
(4,810 Views)

Thank you very much for the quick reply. I put that "application directory" in to my block diagram. Now do I need to mention about the virtual folder which i created under my project? because under the virtual folder only I copied my excel templates. It will be like X.lvproj -->mycomputer-->Templates-->.xlt (template files)

0 Kudos
Message 4 of 20
(4,805 Views)

hi Himanshu Goyal...thanks for quick reply. I have to give only in .exe file format(since the client wont be having this template). So I have to put these templates inside the project and give that path in to my main.vi file. is it possible by this method??

0 Kudos
Message 5 of 20
(4,804 Views)

Hello even,

Thank you very much for the quick reply. I put that "application directory" in to my block diagram. Now do I need to mention about the virtual folder which i created under my project? because under the virtual folder only I copied my excel templates. It will be like X.lvproj -->mycomputer-->Templates-->.xlt (template files)

0 Kudos
Message 6 of 20
(4,797 Views)

Hi again.

 

Here is a strategy I always use when I create a project:

 

Create a folder named for example "My project". In this folder I create new folders called "Bin", "Doc", "Data" and "Img". I put my main Vi in the "Bin" folder and for example the excel template in the "Data" folder.

 

I then create a project in LabVIEW and I add the "My project" folder into this project as an autopopulating folder. This means if I add a file in i.e the "Bin" folder it will automatically come up in the project.

 

When I create my Main.vi and want to use the excel template, I simply add a folder path constant to the "Data" folder on my computer. I don't care about the LabVIEW project file.

 

After I'm done programming and I'm happy with the result I need to prepare the VI for being converted into an .exe file. This means I have to remove all the path constants and add the application folder node mentioned above. I have to know what folder hiearchy I want the installer to create. In this example we can use the folder where the .exe file will be and then a sub-folder named "Data" where the excel template will be. The path will be like "the_folder_where_the_exe_is\data\exceltemplate.xlsx."

 

When I create the .exe file I can add which files that will always be included. Here I add the Data folder containing the excel template. After that I create an installer where I add the folder where the exe file is, which I just created. 

Regards,
Even
_________________________________
Certified LabVIEW Associate Developer

Automated Test Developer
Topro AS
Norway
Message 7 of 20
(4,784 Views)

Thank you so much Even..I will try according ur strategy and let you know if I face any problem. Once again thanks for ur info 🙂

0 Kudos
Message 8 of 20
(4,780 Views)

No problem=) You also have this article with an useful example

Regards,
Even
_________________________________
Certified LabVIEW Associate Developer

Automated Test Developer
Topro AS
Norway
0 Kudos
Message 9 of 20
(4,776 Views)

Hi Even, Sorry to disturb u again n again..I am almost done like ur strategy. Im stuck with adding a folder path constant to the "Data" folder on my computer. Can you please tell me. Right now it is working if i give C:\My_Project\Data\exceltemplate.xlt this path to my mainfile.vi.  Is there any way to mention the templates starting from "Data folder"

0 Kudos
Message 10 of 20
(4,775 Views)