« Close

Datasheets and User Guides

App Notes

Software & Driver

 

5.3 - Doing Daily Logs

Another form of batch logging is daily logging. This is when you create a new logging file every day (or week, hour, or whatever interval). This can easily be done with a simple sequence script. Assuming we still have the MyLog logging set:

1) Right click on SEQUENCES: in the Workspace and select Add Sequence. Call it DailyLog.

2) Once the sequence editor appears, check the box labeled AutoStart.

3) Enter the following script:


while(1) 
   logging.log.strFileName = "c:\mydata_" + formatdatetime("%y%m%d",systime()) + ".csv" 
   delay(1) 
endwhile 

4) Click Apply, then go to Debug - Run this Sequence from the DAQFactory main menu to start the sequence.

All the sequence does is every second reset the file name. The new file name has the date in it. 86399 times out of 86400 it basically does nothing, but at midnight, it will actually change the file to a new name. The logging set will see this and automatically close yesterday's file and start a new one with the new name.

Since the sequence is marked AutoStart, when your document is loaded into DAQFactory, the sequence will start automatically.

Sample file: LJGuideSamples\LogDaily.ctl