LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What is the use of the build path function ?

Hello everyone,

 

i am  a beginner in LabVIEW and i was browsing throught the BUILD PATH function in the FILE I/O section of the Functions Palettte.

 

i just cant figure out the need for the function, why cant i use just one file path 

 

Thanks in advance 

 

Jal

0 Kudos
Message 1 of 8
(7,037 Views)

It works as described in the help: you can add names to a path.

 

Example:

path "C:\" and name "temp" will get added to "C:\temp"...

Using another BuildPath with "test.txt" as 2nd input results in "C:\temp\test.txt"

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 8
(7,028 Views)

Hi,

 

Welcome to the forums and to LabVIEW!

 

The Build Path is quite useful. I use it a lot, here's an example:

 

I have a file path for a folder on my computer where I want to save some generated reports. Lets say C:\Reports. I create a report, but for my software to be able to save the report it needs a whole file path like C:\Reports\Report1.txt. I also want to change the name of my reports, before I save, like Report1, Report2 and so on.  Instead of hardcode a full path each time I can just use the Build Path and use C:\Reports an constant. The report name becomes the variable I can just add to the Build Path which then creates the whole path for my save function.

Regards,
Even
_________________________________
Certified LabVIEW Associate Developer

Automated Test Developer
Topro AS
Norway
Message 3 of 8
(7,025 Views)

The Build Path and Strip Path are very useful functions for creating file/folder paths that are relative to something else in your code.  Relative paths are very useful just in case somebody decides to move your project directory.

 

For example, you put a configuration file in the same folder as your executable.  Let's call it foo.txt.  So you can use the Application Directory to get the folder of your executable (or project file), then use Build Path with "foo.txt" to create the path of your configuration file.  So now if somebody moves your application from C:\blah to C:\temp, your code will not throw an error because it can still find the file.  Hard coding paths in any application will often lead to issues.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 8
(7,011 Views)

thanks everyone for taking the pains to exlain the minor details of the build path function .

 

 

thanks a ton !!!!!

0 Kudos
Message 5 of 8
(6,970 Views)

One main advantage using path datatype and "build|strip path" functions is the fact that they are OS independent. While you could do the same with string functions (e.g. concatenate strings "c:\abd\def\", "ghi\" and  "jkl.txt" to form c:\abc\def\ghi\jkl.txt), you will immediately break the code on all other platforms, because the path format (delimiters, etc) are different on different OSs. The path datatype protects you from these OS differences.

0 Kudos
Message 6 of 8
(6,964 Views)

This looks like a perfect time to shamelessly plug my idea! 😛

 

Make It More Obvious that Build Path Can Accept a Relative Path Input

0 Kudos
Message 7 of 8
(6,927 Views)

Even ,

 

Thank you for extending a warm welcome at the NI Discussion Forum ,

 

I came across the build function vi in the LabVIEW examples for the VDM toolkit, specifically the Pattern Matching example.

 

i am working on a Pattern Matching VI unfortunately i have hit many road blocks.

 

i am enclosing the VI that i have made and the image which i want to compare with itself.

 

i will be grateful if you could help me with this task of mine.

 

Regards

Jalashwa 

Download All
Message 8 of 8
(6,821 Views)