Question:
How can I rename historic files (*.dat) according to the number of records and setting the current date on their names?
Solution:
You can do this by using a crono tag with a 60-second preset. It checks every minute if there is more than a number X of records, and then creates another .DAT file. The tag’s script will look like this:
Dim RecCount, path, Date
RecCount = Hist1.GetRecCount()
IF RecCount > 20
Date = Format(“dd-mm-yyyy_hh-mm-ss”, currentTime)
path = “file_” + Date + “.dat”
Browser1.Query.filename = “”
Hist1.Close()
Hist1.filename = path
Hist1.Open()
name = Hist1.filename
Browser1.Query.filename = name
ENDIF
NOTE: Attached to this article is a sample application developed with Elipse SCADA 2.29 build 92.