TN HistClient124 How to run a sql query in the Historian Client ActiveData Grid using a script
Description
Method to run a sql query in the Historian Client ActiveDataGrid using a script
- Author: Benjamin Davis
- Published: 12/28/2015
- Applies to: InTouch 2014R2
Details
Add the Historian Client ActiveDataGrid to an InTouch window
How to add the Historian Client ActiveDataGrid to an InTouch window
Name the ActiveDataGrid
1. Double click the ActiveDataGrid
2. Type in the name in the ControlName field, e.g., aaHistClientActiveDataGrid1
Set the query using the .SQLString dot field
#aaHistClientActiveDataGrid1.SQLString = "
USE RUNTIME
SELECT Datetime, Tagname, Value, QualityDetail
FROM Live
WHERE Tagname = 'SysTimeSec'" ;
Run the query using the .Execute dot field
#aaHistClientActiveDataGrid1.Execute();
***You can also use concatenation and use Message tags to fill the query***
#aaHistClientActiveDataGrid1.SQLString = "USE RUNTIME
SELECT Datetime, Tagname, Value, QualityDetail
FROM " + StringTag2 + "
WHERE Tagname = '" + StringTag1 + "'" ;