04-19-2013 09:41 AM
hello,
I have a small labview problem.
I created a write to text file with some data in it. The cancelled button of the write to textfile is connected with 'stop labview'
there is no path so labview asks everytime in a popup where i want to store my textfile.
If i give a name and a place on my computer and press ok, labview creates nicely the textfile as i ask.
However if i press the cancel button, the program gives an error (Error 43) instead of stopping the program normally.
Does someone has a solution for this problem?
In fact i want that labview quits if i press the cancel button. Or even better would be that labview goes to a frame before in my flat sequence structure.
Thanks in advance.
04-19-2013 09:51 AM - edited 04-19-2013 10:01 AM
Which VI do you use ? Does it have "error out" on its connector ? If yes, you only need to clear the error cluster in case of error 43.
This can be done by using General Error Handler VI with following inputs :
But you can also easily write your own VI.
04-19-2013 09:58 AM
No there is no error out...
04-19-2013 10:08 AM
Is it a self made VI ? If yes, add error in and error out clusters on the connector and use above mentionned method to clear the error. If no, write your own.
04-19-2013 10:09 AM
Without seeing your code I am assuming you are not handling your errors. If you connect you error wires and handle them some way you won't have this issue. Since you don't have them connected LabVIEW does not know what to do and simply stop your program. A simple way to deal with this would be to connect your error wires to a "Simple Error Handler" as seen in the attached code. This code will stop the loop as you seem to want.
If you want to deal with the user canceling the the file dialog (this is the better solution) there are several ways to deal with this. A simple way to do this would be to use the "File Dialog" express VI to prompt the user to choose a file. This has a "cancelled" output that you could use to go back in your sequence structure before the program gets to "Write to Text File" VI.
04-19-2013 10:53 AM
It does sound like you are not handling your errors and the autohandle errors is kicking in. The cancel action is an error. Can you share your code so we can see exactly what you have?
04-19-2013 10:53 AM
I believe you are using write to spreadsheet and you are right, it does not have error terminals.
As suggested before, use the file dialog express vi but handle the error as below. Error 43 is sometimes an annoyance.