LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write to speadsheet issue

Hello,

 

I am new to this forum and relatively new to labview. I am having an issue with the subvi "write to speadsheet." When a file is finished running, I choose to save the file in a certain directory. However, if (by accident) a pre-existing filename is chosen I will receive the prompt to either replace or cancel the save. If I choose replace I lose the old file. If I choose cancel I loose the new file's data. How can I modify the package subvi to prevent this.

 

Ideally I would like the options: replace, choose other name, or cancel.

 

Any suggestions.

 

Thanks

0 Kudos
Message 1 of 13
(3,352 Views)

I'd check for uniquesness of filename before doing the Save.

0 Kudos
Message 2 of 13
(3,345 Views)

If I enter a name that is already taken, it is usually an accident.

 

I hate to lose hours worth of data over an inadequate program function.

 

 

0 Kudos
Message 3 of 13
(3,340 Views)

People have and solved it by checking the file name before calling the Write to Spreadsheet. Don't you have a path control on the front panel? You could use the Check if File or Folder Exists function. You can also show the Browse button and only allow new files. Lots of ways including modifyint the Write to Spreadsheet function itself (be sure to rename and save in a new location).

0 Kudos
Message 4 of 13
(3,336 Views)

I am leaning toward the modify "write to spreadsheet" function itself. It seems like the other options are external fixes of the original function. I am looking into rewriting it now. If you know of a post or tutorial that has already done this please let me know.

 

Thanks

0 Kudos
Message 5 of 13
(3,322 Views)

The original function really does not need a 'fix' and I don't know of any examples of modifications. I'll bet you could find some examples of specifying the file before calling the function, though. As I said, I think thats the more typical usage.

0 Kudos
Message 6 of 13
(3,312 Views)

As a matter of fact it a very simple 'fix' to an annoying problem.  I'd had times were I would loose 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.   

Message 7 of 13
(3,269 Views)

Thanks!!!! This is exactly what I was talking about.Smiley Wink

 

0 Kudos
Message 8 of 13
(3,258 Views)

It is a really bad idea to write to the file at the end of the program (after the main loop) with no mechanism of recovery. If you architect your program as a proper state machine, you data is stored e.g. in a shift register and saving to a file just executes another state, without stopping the loop or modifying the data in the shift register.

 

 

0 Kudos
Message 9 of 13
(3,255 Views)

Say what?

 

I don't know what that meant.

 

Are you refering to when we write the original program or the re-writing of the "write to speadsheet" subvi?

0 Kudos
Message 10 of 13
(3,251 Views)