Using the Wonderware Historian as a SQL Database - j5 - 28.0 - Help - Hexagon PPM

j5 Wonderware Historian Datasource Connector Help

Language
English (United States)
Product
j5
Search by Category
Help
j5 Version
2019

j5 Wonderware Historian Interface uses an ODBC SQL connection to communicate with the historian. The same connection can be used from an IndustraForm to execute a custom SQL query using the IMPORT.SQL function.

Using SQL Queries to Retrieve Data from a Wonderware Historian database table in an IndustraForm

Using Data Binding on an IndustraForm section and the IMPORT.SQL formula, a SQL query can be used to query Wonderware Historian tables. (This of course assumes that the user configured to access the database has the appropriate statement execution permissions.)

The following is an example of a databinding that retrieves information from the History table for the tag "SysPerfCPUTotal" between the two dates passed in as parameters.

= IMPORT.SQL("ww_historian", "SELECT DateTime, TagName, Value FROM Runtime.dbo.History WHERE TagName = ? and DateTime >=? and DateTime <=? and wwTimezone = ?", "SysPerfCPUTotal", "2018-04-09", "2018-04-10", "UTC")

This information can then be displayed by making use of the BOUNDCOL function where each column of data to be displayed needs its own BOUNDCOL statement referencing the name of the column as a parameter.

When this is done, the correct number of rows will automatically be displayed depending on how many rows are returned from the query.

Querying Wonderware Tags in IndustraForms

For more information about databindings and the IMPORT.SQL formula, refer to the chapter "IndustraForm Wizardry" in j5 IndustraForm Designer Tutorial.

Using Stored Procedures to Retrieve Data from a Wonderware Historian database table in an IndustraForm

It is possible to make use of Stored Procedures from a Wonderware Historian database within an IndustraForm.

As with retrieving table data, this can be done by making of use the IMPORT.SQL function.

The example below demonstrates an example of using Wonderware’s aaAnalogDetail Stored Procedure which returns information about one or more analog tags passed in as a parameter.

= IMPORT.SQL("ww_historian", "EXEC aaAnalogDetail ?", "SysPerfCPUTotal")

For more information about different stored procedures available in Wonderware Historian, refer to the Stored Procedure section of Wonderware Historian Server Database Reference.