Processing of placeholder queries, Design placeholder queries – Rockwell Automation FactoryTalk Historian SE ProcessBook 3.2 User Guide User Manual

Page 276

Advertising
background image

FactoryTalk Historian ProcessBook User Guide

258

The standard SQL placeholder character is (?). Placeholders are numbered
in their order of appearance, from left to right, in the query statement.

For example, the following query statement has two placeholders, one for a
text string for a sample ID and the other for a sample time.

Select value, sample_time from Lab_data where sample_ID=? and
sample_time>?

FactoryTalk Historian ProcessBook allows text, start times, end times, or
tag values as substitutes for placeholders.

Processing of Placeholder Queries

Text placeholder values are substituted into a query when it is run. Start
and End times are determined when a display is opened and are substituted
into queries at execution.

Tag values can also be used as placeholders. With a Tag placeholder, a join
is processed between the ODBC data source and the FactoryTalk Historian
data source. When a display is opened, FactoryTalk Historian ProcessBook
obtains tag values between the start and end time and substitutes these
values into the SQL query, one at a time (in effect, executing the query for
each FactoryTalk Historian tag value returned). The use of a tag
placeholder is shown in the SQL query statement below:

Select target from specs where product_code=?

In this example, the values of the tag in the FactoryTalk Historian system
that records the current product code are retrieved. The result set of the
ODBC query is built by executing the query once for each placeholder
value. In the case of this example, that would be one query execution for
each product code found between the start and end times of the symbol.

Design Placeholder Queries

Placeholders can be customized for a symbol. You can create an ODBC
data set with a set of default placeholders. When that data set is attached to
a specific symbol, the query’s placeholders can be customized for that

Advertising