Timed Writing to ODBC Database


Recommended Posts

I am attempting to write files to a database at the half hour using a sequence.

This is what I have been able to get so far using some other resources in the forum.

private nexttime = floor(systime()/1800) * 1800 + 1800  
// calc next half hour point
while (1)
	  here is what I would like to do with the data
	  db. open a database table using ODBC
	  db. store a date to the table
	  db. store a time to the table
	  db. store a bunch of channels and v channels to the table
   nexttime += 1800

Standard logging is not really what my client desires as far as time stamps go since I would have to store a sample per minute to give him the accuracy he desires, and getting it to be timed properly is a bit of a problem.

Appreciate any help!


Link to comment
Share on other sites

Well you could use the db. functions, and that would give you the ultimate in flexibility, but you'd have to know SQL. You could also use an export set. You'll still get DF time in the first field, but you could put the date, time, and channels in other fields. Just make sure everything has [0]. So, for example, the expression for date might be:


and time:


then data from channel:


and V.channel:


Finally, you'll want to select Fixed interval on the details page of the export set, then Snapshot

Then in your sequence where you have all that db. stuff, just do beginexport(myexport) where myexport is the name of your export set.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.