Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Timestamping dat files with header info


Brightshadow Apr 6, 2009 02:25 PM

I'm attempting to find out how to provide a header line for the dat files written daily to the loggernet dat file directories.

I'm thinking of a timestamp for the first line of the dat file, and then when the dat file is updated during CR1000 polls, it will update this line to reflect the new timestamp.

I've searched through almost every option in Loggernet, and in the manual, and am at a loss. Any assistance you can offer would be most appreciated! :)


Dana Apr 6, 2009 06:38 PM

One alternative you might want to look at is our Baler client. It bales files into defined "chunks", based on time, and gives them a unique file name. For instance, you can set up Baler to store files hourly, every 4 hours, or every 24 hours. The file name reflects the timestamp of the first record in the file. This would not insert a string into the data file, but the file name would indicate the timestamp. The Baler is a client that is sold separately from LoggerNet. The files created by the Baler do not affect the other dat files created by LoggerNet -- they are separate.

I apologize if this sounds like a sales pitch. It's not meant to be. I just don't know that you can easily accomplish what you are asking, other than devising some batch file scheme that inserts this line into the data file, and then running that batch file as a LoggerNet task that occurs "after data collection" for the station. For instance, you could take your current CR1000 header from a file and save that all by itself, then create a bit of code that runs in a batch file and generates your timestamp string, and then have another batch file that saves the header file + your timestamp string + the data file (set in LN to "overwrite each time" so it contains only new data) under a new file name.

(an option to saving the data file in LoggerNet as "overwrite each time", would be to process the file using Split to create a file, using the "process new data only" option.)

Another option might be to write the table to the CR1000's USR drive using the TableFile instruction (see the CRBasic help file), then read this file in (FileRead), insert a string after the header, and write the file back out again. I think it is doable but would probably take a lot of monkeying around to get it just right (as would the batch file option above).

In the end, I think it would be easier to use Baler if a unique timestamp would suffice :) But, maybe this will spark some ideas of other ways you can accomplish what you need.

Regards,

Dana

Log in or register to post/reply in the forum.