SQL Tag Template

PARCview can read and present information from any OLE DB or ODBC compatible data sources that can return time-sequenced values. This includes data stored in Microsoft SQL Server, ORACLE, and other relational databases.

PARCview uses SQL query templates to retrieve data from SQL databases. A SQL Tag Template is a set of SQL scripts that each return a specific data set based on the nature of the request from PARCview. Examples of these requests include building a tag list or retrieving tag data points. Each script is expected to return data in a specific column order, but it can be queried out in different ways depending on how it is stored in its native source and what constraints or criteria are desired.

A SQL Tag Template will typically correspond to one data source. PARCview uses the template’s scripts to retrieve the requested data for all tags in this source. Note, however, that multiple sources can use the same template, and multiple templates can access the same SQL database.

SQL Tag Templates feature tokens for dynamic text-to-value substitution. At execution the tokens are replaced in the query with appropriate argument values retrieved from PARCview. For example, queries will use information from PARCview displays, like using the start and end times of a trend as the start and end time bounds in data queries. User-defined tokens can also be used as custom parameters for retrieving a tag list, if needed.

Template Name: Each template must have a unique name. It does not have to match the corresponding source name. The SQL Tag Template for a SQL-type source is defined in Source configuration, in the server column. Open the Template Name drop-down menu to select from existing templates. To create a new template, make sure no template is selected, then enter a new template name.

Refresh Delay: Throttles frequent requests for current values by only executing once per delay interval.

DSN: The DSN field contains the connection string that PARCview uses to connect to the SQL Server. This field typically contains a file path to a .UDL file, with the syntax:

FILE NAME=\\UDL File Path\UDL File Name.UDL

This field also accepts an OLE DB connection string, with the syntax:

Provider=SQLOLEDB.1;Password=PASSWORD;Persist Security Info=True;User ID=SQL USER NAME;Initial Catalog=SQL DATABASE NAME;Data Source=SQL SERVER INSTANCE NAME

Use PARCview DSN: Check Use PARCview DSN to always use PARCview’s current database connection as defined in Select Site. This option is useful when querying data out of the dataPARC configuration database, such as MDE, Alarm Event, Logbook, or Tag Limit data or when a linked server to the other database is created in the dataPARC configuration database.

Test DSN: Validates the DSN.

Script Type: There are three basic script types: tag queries that are used by PARCview to get tag information, read data queries that return tag values for a given time frame, and write data queries that modify tag values in their source.

Test Execute: Executes the SQL script. The Evaluate SQL Template window will open.

Date/Time Parameter Format

Format: The format of that dates and times will be displayed. Use time key letters, such as H for hour, M for month, m for minute, etc.

Test Value: Displays an example output of the Date/Time format.