InTouch example: history data over a LAN
- Last UpdatedFeb 05, 2025
- 1 minute read
The following example demonstrates how to connect to the AVEVA Historian named "maggie" on a LAN. The example retrieves the last 45 minutes of history data for the 'SysPulse' tag.
#aaHistClientActiveDataGrid.ServerName ="maggie";
#aaHistClientActiveDataGrid.UserName = "wwUser";
#aaHistClientActiveDataGrid.Password = "wwUser";
#aaHistClientActiveDataGrid.DatabaseName = "Runtime";
#aaHistClientActiveDataGrid.SQLString = "";
#aaHistClientActiveDataGrid.SQLAppend("DECLARE @StartDate Datetime");
#aaHistClientActiveDataGrid.SQLAppend("DECLARE @EndDate DateTime");
#aaHistClientActiveDataGrid.SQLAppend("SELECT @StartDate = DateAdd(mi, -45, GetDate())");
#aaHistClientActiveDataGrid.SQLAppend("SELECT @EndDate = GetDate()");
#aaHistClientActiveDataGrid.SQLAppend("SELECT Tagname, DateTime, Value");
#aaHistClientActiveDataGrid.SQLAppend("FROM v_DiscreteHistory");
#aaHistClientActiveDataGrid.SQLAppend("WHERE TagName IN (‘SysPulse’)");
#aaHistClientActiveDataGrid.SQLAppend("AND DateTime >= @StartDate");
#aaHistClientActiveDataGrid.SQLAppend("AND DateTime <= @EndDate");
#aaHistClientActiveDataGrid.SQLAppend("AND wwRetrievalMode = ‘Delta’");
#aaHistClientActiveDataGrid.Connected = 1;