LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with writing to new file every day, error #1

Solved!
Go to solution

Hi, I have build a vi which writes measured data to file every second. This vi will be used for long term data acquisition and I want to write the data to a separate file every day, else the file becomes

very large. The vi is supposed to work as follows, first set the folder to save to and then start logging with the "datalogon"button, first write the column names to the file and after that write the data

every second. If the date is the same log the data, if the date is not the same write to new filename, write the column headers and write the data again every second.As file name the date is used.

 

This is working pretty good only at the start of the vi I get the message "Error 1 occurred at Open/Create/Replace File in Write Spreadsheet String.vi->Write To Spreadsheet File (string).vi->RNH-

SerialDaq-03APR2013.vi. I have done some test and it seems that in the first or second run of the loop the appended path is "file name:\" and not drive:\ and this seems to be caused by the fact

that I first write the column headers and second the data (if I only write the data the problem does not occur).

 

So I (think) to now what the problems is but don not know how to solve it, I would appreciate it if someone could help me with this.

 

Kind regards, Martin  

 

0 Kudos
Message 1 of 6
(3,901 Views)

Please wire the shift register through the false case as well and try.


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

Hello .aCe, unfortunately that doesn't solve the issue. I get the same error. 

0 Kudos
Message 3 of 6
(3,859 Views)

I have done some test and it seems that in the first or second run of the loop the appended path is "file name:\" and not drive:\ and this seems to be caused by the fact

that I first write the column headers and second the data (if I only write the data the problem does not occur).

 


Does the loop work fine if you write data repeatedly? or is it just the first write that works? (this could indicate problems with how fast you are accessing the file).  Every second seems excessive to me.  I would store 30sec to 1min of data in an array and write it to the file in larger time intervals.  

 

you clearly mention that the file path is incorrect.  Make sure you are building it correctly (use the Build Path vi from the File I/O pallete to reduce human errors).  You can use a relative path by using the "Current VI path" along with Strip and Build Path vis.   

0 Kudos
Message 4 of 6
(3,853 Views)

It's working fine for me.  The two things I changed was wired the path from the shift register through the false case (when NOT logging) and initialized the shift register to the input path folder.


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
Message 5 of 6
(3,849 Views)
Solution
Accepted by topic author SiddySI

I have made the modification you mentioned and to my surprise I got the error message and also with the vi you have sent, I have taken a closer look at this and found that:

- if I first enter the "folder to save file to", then run the vi and then hit the "data log on" I do not get the error.

- if I first run the vi, then enter the "folder to save file to"and the hit the "data log on"I do get the error.

 

I also tried this with the original vi (without the shiftregister connection in the false case and the init for the shift) and that gives the same result as above. Further if i get the

error message and choose stop the vi, start the vi again I don't get the error because folder to save file to is entered. This issue only seems to appear when there is no "folder

to save file to"in the dialog box.

 

While Im writing this I realize that "folder to save file to" is outside the while loop so only executed when the vi is started maybe I have to put it inside the while loop? Tried 

this and at first it seems the issue is solved, I do not get the error message on my screen but it still appears on the error handler in an other part of the vi (visa serial).

 

Ah, got it. The "visa resource name" and "folder to save file to"are both outside a while loop and are only read when the vi starts, at that moment they do not have a valid

value so the error is generated.

 

Issue solved, thank you al for your input!

 

Best regards, Martin  

      

0 Kudos
Message 6 of 6
(3,836 Views)