42269members
186177posts

Historic Data Export

Highlighted
Crewman

Historic Data Export

Please how do i export HISTORICAL DATA from clearscada to a CSV file. I want it to be in form of a button, when the user wants to export he can click the button and inputs the period for which he wants to export the historical data. Please is this possible?

10 REPLIES 10
Highlighted
Lieutenant JG

Re: Historic Data Export

Sure, lots of ways, the best way really depends what you want to do with the CSV file afterwards

 

* Use the CSV Export driver, but may not be as flexible that you need

* Use logic, use VAR INPUT to define the time and %S to query the data from CDBHistoric, then use and FILE_WRITE() functions. This will store the file on the server and has the advantage that it can be both scheduled and manually triggered, but again lose some flexibility on defining the source point

* Use scripting on mimics. Use the Form object or similar to prompt for date inputs, Server.Query to get the data from CDBHistoric and create a COM object to fso to write files to the local workstation's disk. Probably lots more flexibility with this one but more coding required

Highlighted
Crewman

Re: Historic Data Export

I am new to clearscada, but i'm gonna try your 3rd option , i think it would work. Thanks!

Highlighted
Sisko

Re: Historic Data Export

The first option - the facility is called 'SQL Expert' - find the object in the Create ... New ... Other menu.

Any SQL can be written which exports that data in CSV (or tab) into a file. This can be scheduled or triggered from the client.

Note that option 1 may or may not work on WebX, and on Virtual ViewX will write a file on the web server.

 

(This thread should be in the Geo SCADA forum, but I don't see an option to move a thread. 🙂  )

Highlighted
Crewman

Re: Historic Data Export

Yeah i have tried the SQL export, but its not as flexible as i want, the Client cannot specify the date range in which he wants to export the historical data and also, it doesnt save each export in a new CSV file, it overwrites the old one.

Highlighted
Sisko

Re: Historic Data Export

The issue about parameters - noted!

 

Filenames - you can use trip characters to add parts of the date/time stamp, e.g. %Ddd MMM yyyy% %THH:mm:ss%

Highlighted
Crewman

Re: Historic Data Export

When i do this, does it export in a new csv file with the new time specification? Although i tried this format"%Ddd MMM yyyy% %THH:mm:ss%" and it kept giving me "Invalid OPC relative time for trip sequence", this was the format that worked e.g D-2D or H

Highlighted
Sisko

Re: Historic Data Export

Yes, it creates a new file, leaving the old file in place.

You can use the time/date sequences in both file and folder names.

Highlighted
Crewman

Re: Historic Data Export

It worked!, so i used the  %THH mm ss% format in the Output filename. It creates a new file now. Thanks! Prolly try to figure out how the client can specify the Date range he/she wants.

Highlighted

Re: Historic Data Export

Hi, does this topic relate to https://www.se.com/ww/en/faqs/FA312272/
Also, does a  .HRD / .csv file contain historic data relating to all points with historic data? I have not seen one of these files structure just yet.

(I notice, by week, yes?)
Thanks,

Tags (1)
Highlighted
Sisko

Re: Historic Data Export

While using the raw historic files is possible, I don't recommend this method for an application, just for diagnostic purposes.

Tags (1)