LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write to text file

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.

 

 

0 Kudos
Message 1 of 7
(2,613 Views)

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 :

 

  • type of dialog : none
  • exception action : Cancel error on match
  • exception code : 43

 

But you can also easily write your own VI.

 

 

0 Kudos
Message 2 of 7
(2,607 Views)

No there is no error out...

0 Kudos
Message 3 of 7
(2,605 Views)

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.

0 Kudos
Message 4 of 7
(2,598 Views)

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.  

error handler.png

 

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.  

 

file dialog.png

 

Lukin
Certified LabVIEW Architect
0 Kudos
Message 5 of 7
(2,597 Views)

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?


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 6 of 7
(2,575 Views)

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.

error.png


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
0 Kudos
Message 7 of 7
(2,574 Views)