TN HistClient124 How to run a sql query in the Historian Client ActiveData Grid using a script
Last updated: March 4th, 2025Description
- Author: Benjamin Davis
- Published: March 4th, 2025
Details:
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
- Double click the ActiveDataGrid
- 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 + "'" ;