LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

detection if a file is wrong

Hello!

We are supposed to read a text-file that have a certain look. But if one picks a text-file that looks in another way we want the program to pop up a box with a warning. The way it is now is that an errormesage appears from LabVIEW or that the program runs but nothing happens... we want to have an own warning and that the program will quit when this warning appears. Any tip or ideas about this? See the attached VI so you can see the problem.
0 Kudos
Message 1 of 2
(2,644 Views)
First of all, you can replace the while loop with a for loop. Just use the array size for N or wire the array into the loop to auto index. Just a point.
Regarding the question, I'm assuming you need 3 underscores (_) in each line. If that is the case, take the "Offset after match" (I think that's its name) output from the match pattern VI and check to see if it's -1. If at least one of them is, your file did not match and you can return your error.
You can do this by using the one button dialog box VI or by incorporating your error as a LV error cluster, which is more complicated and probably unnecessary for something like this. Then, you can place the entire thing in a loop and tell the user "the file was wrong. Select another.".
BTW, the error you were getting from LV was probably you tried reading a non existing file.

___________________
Try to take over the world!
0 Kudos
Message 2 of 2
(2,623 Views)