LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write to speadsheet issue


@kemfizix wrote:

As a matter of fact it a very simple 'fix' to an annoying problem.  I'd had times were I would loose lose experimental data because I accidently select a file that I don't want replaced. 

The error that you get when this happens is 43. In the write to spreadsheet file vi I added a loop and told it to repeat writing the file if this error occurred.  There are a few messages that you just have to press continue but those can be changed if you dig in a little deeper.  Also, the three button idea is good, I 'm pretty new in LV and using LV 7 express, so I don't know if later version have remedied this annoying bug, but I'll dig in a little deeper to see how i can intergrate the 3 button idea.   


The screenshot you posted in the .pdf file is not a solution and Mrphud should unmark that reply as a solution.  Your while loop will either run once, or will run forever.  If there is no error 43, all is fine.  If there is error 43, that while loop will run forever because nothing inside the while loop ever changes to make it any different.  All the data is passed in through tunnels, and the tunnels will never change!

 

There is nothing wrong with the Write to Spreadsheet VI.  If you have an issue with it selecting an existing file you don't want to overwrite, then you use the appropriate File checking VI's in your main program in a while loop (where you allow the user to change file name inside the loop) before you ever pass a file path to the Write to Spreadsheet File VI.

0 Kudos
Message 11 of 13
(430 Views)

Though I now understand what you are saying, I am curious why there is a need in the first place. Unless there is a specific reason for it, I would suspect that a vi would be constructed in such a way to avoid some added check and balance in every program that uses "write to spreadsheet". It seems bad practice to require users to circumvent potential headaches, because a function/subroutine/vi is seemingly incomplete or insufficient.

 

Why not just integrate the check and balance?

0 Kudos
Message 12 of 13
(420 Views)

"Write to Spreadsheet file" is a high level file function and does exactly what it it supposed to do. Nothing more, nothing less.

 

Calling a save operation should never be an irreversible program step. Any reasonable code will not stop the program or lose the data just by calling a file IO function. That's just very shortsighted and bad programming.

 

What if the programmer clicks cancel by accident at the file dialog and wants to go back and save after all? Yo also need to protect against that!

 

If you really feel you need that kind of functionality, you can make a diaper wrapper VI around the existing VI that does exactly what you want, save it under a new name (e.g. "stubborn write to spreadsheet file.vi") , and place it in your user palette. 😉

 

 

0 Kudos
Message 13 of 13
(411 Views)