04-13-2009 03:22 PM
I have written a VI to create and update a file as many times as needed on any given day. On any subsequent day a new file is created which for that day will be updated each time the VI is run and so on. The problem is that when I run the VI the first time of a new day, ie when the file is created only data is written to the file and not the header data. When the file is appended, header data, and regular data is properly written to the file. Can anyone tell me how to correct this problem? A copy of the VI that I wrote is attached.
Thanks,
Chuck M.
Solved! Go to Solution.
04-13-2009 05:56 PM - edited 04-13-2009 05:58 PM
You had the header information written when there wasn't an existing file, then you overwrote that file with another file consisting only of the data because you wired the "append to file? (new file:F)" the same for both functions (F causes it to create a new file). I put the header writing function in a Case structure because you only want it to execute when this is a new file (otherwise it'll overwrite what's there). Wire the path straight through the False case. I wired a TRUE to the data writing function to always append (because there will always be a file by the time the program gets there).
Jim
PS - a few other observations
04-14-2009 09:21 AM
Thanks for your help. Your solutions works perfectly. I want a header printed each time I run the VI so I added the "Write File" function to the "T" condtion of the case statement with true wired to it from the case selector in addition to what you have shown.