08-26-2009 03:31 AM
I have a need to check if a path entered by the user is valid.
That is to say that I want to be able to return an error if the path is left blank, doesn't point to the correct file type (.csv in this case) or points to an invalid location (i.e. a user typo).
The first and second are straightforward (using 'Empty string/path' and a simple string comparison, respectively), but I don't know how to implement the third. I have tried the 'Not a number/path/refnum' block, but to no avail.
Any suggestions gratefully received.
Dan
Solved! Go to Solution.
08-26-2009 03:44 AM
Hi Dan,
what is the third part?
Maybe the attached picture helps.
Mike
08-26-2009 03:49 AM
Hi Mike,
Thanks for the reply.
Your solution is essentially exactly the same as what I tried initially.
However, I'm not able to get the 'Not a number/path/refnum' block to produce a TRUE output.
Under what circumstances should this block give a TRUE output?
Dan
08-26-2009 03:52 AM
Hi Dan,
you'll get a true if you connect the "Not a Path" constant to it. You can use it to check if the path changes after you have initialized it with "Not a Path".
Mike
08-26-2009 04:04 AM
OK then, back to my specific problem...
I want to be able to check that a user-entered path actually points to a file that exists.
For example:
Say the geniune file is C:\Documents and Settings\test_file.csv.
However suppose the user enters something like C:\Documents and Sattings\test_file.csv or C:\Documents and Settings\toast_file.csv.
I want my VI to be able to pick up the error, and flag it up, before Labview tries and fails to open the file.
08-26-2009 04:20 AM
Hi Dan,
which LabVIEW version do you use? In LabVIEW 8.5 an later, there is a function "Check if File or Folder exists". If you use an earlier version, then you can try to open this file and check if you get an error.
Mike
09-13-2015 10:47 PM
I would like to know how to make a vi that checks and reads the new entry path using labview.Kindly rply me pls.
09-14-2015 07:24 AM
You're replying to a 6 year old thread, that asks the same question as you, and answers it. Please re-read the thread for your answer.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
09-14-2015 10:48 PM
Sorry sir.That message and .png file gives the code to check whether the path is valid or not.In my project there will be data logging everyday.So everyday a new log file has been created.What i need is to use that new log file each timewhen it has been created.Kindly help me pls
09-14-2015 11:00 PM