11-07-2012 03:52 PM - edited 11-07-2012 03:53 PM
I'm looking ways to store paths, so that when I run a VI that requires that path, I do not have to set it.
What I want is to establish it once> Store it> open a VI that automatically select.
I have an example but it gives a bad result.
Solved! Go to Solution.
11-07-2012 05:08 PM - edited 11-07-2012 05:14 PM
That's not an example, just a bad image. Why don't you attach the actual VI instead? Why do you have so many sequence frames???
There are millions of possible "bad results". Can you narrow it down a little bit and tell us in what way it is bad? (incorrect file, error message, computer explodes, etc.)
(Just looking at the image, there are many questionable constructs. Why is there no input to "check if file exists"? Why are there hollow output tunnels? What is in the other cases? Why are there so many case structures tied to the same boolean, can't you put all TRUE (or FALSE, resp) code in one case structure instead? This code is incredibly chopped up. ;))
11-07-2012 09:23 PM
wow...
11-07-2012 10:46 PM
Ok, this is a functional VI. Firstly I'm write a code thats save the process of select a path for a file(wathever), now I designed this code for solve this problem, I'm designig a VI that needs a lot of paths(this path connects a .udl file to stablish a connection betwen LV and a DB in acces, then how I inserts/delete data to the DB from differents VI's, I prefer to do a VI that save the procces for stablish the connection. And I want to make this step auto;
The procces(how I want to run this VI in different systems, I try to do this VI);
1.- When I open a principal VI, my Conexion UDL.VI runs(for this I have created the DB and UDL file).
2.- I select the UDL file for stablish the connection.
3.-Then I select a folder for UDLreg.txt for save the path(in string) of the .UDL file.
3a.-The "Check if file or folder exists" is for the case in wich the UDLreg.txt dont exist create it and write the path.
4.- If the "Check if file..." indicates True(the file exist) this ignores the past step and read the file and indicates the Path for the .UDL
5.- This path is written to string indicator and I link this to the connector pane for use this in the mentioned VI's;)
And so I created a vicious circle for don't select the .udl again. I hope that you can understandme.
The other way to do this is creating a relative path but how I want to create a .exe file for the VI and run in other pc's I can do this or I don't know how do it.
11-07-2012 10:49 PM
One thing to think about is creating a configuration file that contains any constant file paths you need. I think its a bad idea to have hard coded paths in your code.
11-07-2012 10:52 PM - edited 11-07-2012 11:02 PM
But if I create a constant file path when I try to run the VI in different systems this could show an error?
I understand your suggestion, thankyou!!
11-07-2012 11:24 PM
@abraham94 wrote:
Ok, this is a functional VI.
No, it is still only a picture of a VI! 😞
I am glad it is working for you, but you could delete the entire flat sequence structure and nothing would change. The execution order is fully determined by dataflow anyway. Try it! 🙂
If you are using windows, this might be a situation where you could write a registry entry instead of a file. LabVIEW has full support for that.