You can run SQL Queries against the ClearSCADA using the Hach WIMS SQL Console, or using ClearSCADA's ViewX application. To use the SQL Console, you will need the connection string first. Run the interface and select the menu option Configure > Source Configuration:
Click on the View Connection button, answer Yes to see the password, and then copy the text in the message box that appears on your screen:
Now run the application SQL_Console.exe found under the Hach WIMS Client folder, and select OLEDB source and paste the connection string in the text box below:
In the application text box, enter any of the following queries, changing the date range in the BETWEEN clause or the full tag name FullName='this tag name'. The interface will provide queries in its' log files when you turn the verbosity to level 3 or higher.
Average:
SELECT AVG(CurrentValueAsReal)
FROM CDBPoint, CDBHistoric
WHERE CDBPoint.ID=CDBHistoric.ID and
FullName='Sheboygan WWTP.I-O Points.RWW.Wetwell Level'
and (Recordtime BETWEEN{ts '2011-10-01 00:00:00'} AND {ts '2011-10-02 00:00:00'}) and
CurrentValueAsVariant is not null
Minimum:
SELECT MIN(CurrentValueAsReal)
FROM CDBPoint, CDBHistoric
WHERE CDBPoint.ID=CDBHistoric.ID and
FullName='Sheboygan WWTP.I-O Points.RWW.Wetwell Level'
and (Recordtime BETWEEN{ts '2011-10-01 00:00:00'} AND {ts '2011-10-02 00:00:00'}) and
CurrentValueAsVariant is not null
Maximum:
SELECT MAX(CurrentValueAsReal)
FROM CDBPoint, CDBHistoric
WHERE CDBPoint.ID=CDBHistoric.ID and
FullName='Sheboygan WWTP.I-O Points.RWW.Wetwell Level'
and (Recordtime BETWEEN{ts '2011-10-01 00:00:00'} AND {ts '2011-10-02 00:00:00'}) and
CurrentValueAsVariant is not null
First:
SELECT TOP (1) Recordtime, CurrentValueAsReal
FROM CDBPoint, CDBHistoric
WHERE CDBPoint.ID=CDBHistoric.ID and
FullName='Sheboygan WWTP.I-O Points.RWW.Wetwell Level'
and (Recordtime BETWEEN{ts '2011-10-01 00:00:00'} AND {ts '2011-10-02 00:00:00'}) and
CurrentValueAsVariant is not null order by Recordtime ASC
Last:
SELECT TOP (1) Recordtime, CurrentValueAsReal
FROM CDBPoint, CDBHistoric
WHERE CDBPoint.ID=CDBHistoric.ID and
FullName='Sheboygan WWTP.I-O Points.RWW.Wetwell Level'
and (Recordtime BETWEEN{ts '2011-10-01 00:00:00'} AND {ts '2011-10-02 00:00:00'}) and
CurrentValueAsVariant is not null order by Recordtime DESC
Total:
SELECT SUM(CurrentValueAsReal)
FROM CDBPoint, CDBHistoric
WHERE CDBPoint.ID=CDBHistoric.ID and
FullName='Sheboygan WWTP.I-O Points.RWW.Wetwell Level'
and (Recordtime BETWEEN{ts '2011-10-01 00:00:00'} AND {ts '2011-10-02 00:00:00'}) and
CurrentValueAsVariant is not null