Topic 5.1.2 – Use of Wildcards in Reports
Date and Time Wildcards
If you need to
create recurring reports that cover the same time period, you can use date and
time variables, or wildcards, in the report template. For example, you might
want to produce a daily report that always covers the time period for the first
shift, which starts at 8:00 a.m.
The wildcards are:
- #time wildcard – Used as a placeholder for the current
(today's) date, but a specified time
- #date wildcard – Used as a placeholder for
a specific date and a specified time
- #ReportTime wildcard
– Used as a placeholder for a defined
report time to be used with
either #date or #time
The values used for the #date and #ReportTime wildcards are set for the entire report using the
Report Options dialog box.
These wildcards
are handled only by Wonderware Historian Client Report; queries that include
them do not work in the other query tools, such as the Wonderware Historian
Client Query or the Microsoft Query Analyzer.
Use of #time(xx:xx) Variable
The #time variable is used in the time functions to represent today. The use of this wildcard
allows you to run the report document on any day and retrieve the data
for the same time period. The date portion
of datetime is the current date. The
time portion of datetime is the time specified in the brackets.
For example,
the WHERE clause
for a query for the last 8 hours of today's data, starting at 17:00
is as follows:
WHERE DateTime >= '#time(17:0:0)-8h' AND
DateTime <= '#time(17:0:0)'
The time specification for the query is indicated in the parentheses.
Valid duration units for all
variables include:
s seconds
mi minutes
h hours
d days
w weeks
mm months
Note: If part of your job function is to prepare a daily report,
such as a production report that covers the same period each day, you can use
the #time variable to create a
template report that can be run each day.
Use
of #date(xx:xx) Variable
The #date wildcard is used to represent a
specific date in the query. This allows reports to be based on the same time
period. This wildcard is similar to the #time
wildcard. The #time wildcard is
a placeholder for the current date, and the #date wildcard is a placeholder for a specific date.
For example:
WHERE DateTime >= '#date(17:0:0)-8h' AND
DateTime <= '#date(17:0:0)'
The WHERE clause indicates to use the last 8 hours of data, starting
at 17:00, for the date that is
specified
by the Report Date option in the Report Options dialog box. The time specification for the query is specified within the parentheses. Valid duration units for all
variables include:
s seconds
mi minutes
h hours
d days
w weeks
mm months
Use of #ReportTime(xx:xx) Variable
The #ReportTime wildcard is
used to represent the report time in the query. This wildcard can be used with
the #time and #date wildcards. When a report time is set, this wildcard is
replaced by the defined report time.
For example:
WHERE DateTime >= '#time(#ReportTime)-8h' AND
DateTime <= '#time(#ReportTime)'
This WHERE clause indicates to use the last 8 hours of data, for
today's date, for the time that is
specified by the Report Time option in the Report
Options dialog box.
Another example is:
WHERE DateTime >= '#date(#ReportTime)-8h' AND
DateTime <= '#date(#ReportTime)'
This WHERE clause indicates to use the last 8 hours of data for the
date and time specified by the
Report Date and Report Time options, respectively, in the Report Options dialog box.
Note:
The #date and #ReportTime wildcards are Wonderware
Historian Client Report wildcards. Queries that include them do not work in
other query tools, such as Wonderware Historian Client Query or Microsoft Query
Analyzer.
Valid duration
units for all variables include:
s seconds
mi minutes
h hours
d days
w weeks
mm months
Last modified: Thursday, 4 July 2019, 1:47 PM