Showing results for 
Search instead for 
Did you mean: 

New save file daily

Go to solution

Hi all,


It's been a little while since I posted anything here but here we are, back at it with LabVIEW. I have a VI (attached) that takes a few different continuous data sets from different modules but I have found that when the program is left running for extended periods of a time, say 2 weeks, the save files can become somewhat hectic. Under the "update UI" state of the block diagram there is a section labeled the "TVA data producer" which reads two different data values each second "temperature" and "flow rate". Both of these are then written to the same TDMS file along with the current date and time, where the save file is also denoted by the time and date that logging was started. The issue I have is that I would like to be able to change the save sequence for these data sets to create a new save file for each time a new days begins whilst the program is running, opposed to just creating one on the day it is started and then continuously adding to this until the program is stopped potentially days or weeks later. Hoping for any help I can get since I was planning on tackling this solution at some point this week *screams internally*.


Many thanks in advance as I know you're all very helpful people! for rookies like myself!




P.S. I have added a few images to hopefully better explain the issue showing the data source from serial COMs and how the data is saved under the current date.

0 Kudos
Message 1 of 4

What you want to do isn't that difficult, but you'll want to have some parallel loops to enable you to separate out various tasks.  I presume you know about Producer/Consumer Designs, where you have a Producer that generates data and a Consumer that writes it to, say, a TDMS file.


Suppose you wrote the Consumer as a Queued Message Handler, accepting a "Write Data" Message from the Producer and an "Open New File" Message from a loop that fires once a day to close the old file and open a new one.  There's a bit of extra bookkeeping you'd need to do (such as knowing when to close the existing file, though that could be a separate Message, and knowing how to stop the Once-a-Day loop when the program ends).


Some comments:

  • Write code so all Block Diagrams fit on a single screen.  Use lots of sub-VIs to "save space" (they only take 32 x 32 pixels and can have a whole lot of functions inside them).
  • Please do us a favor/courtesy and never (well, "almost never") attach "pictures of code" -- attach the VI, itself.
  • To get around the "3 attachment" limit (such as to attach an entire Project), put what you want to attach into a folder, right-click the folder and choose Send To, Compressed File, and attach the resulting .zip file.

Bob Schor

Message 2 of 4
Accepted by topic author SteveR_

I'd make a function that generates a filename based on the date. Then use a shift register to remember the current result file, if they're different (new day) you close the current one and open the new file and write in that one.


G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
0 Kudos
Message 3 of 4

That I can do! Thanks for the suggestion, I'll get started and see how it goes.

Message 4 of 4