Sei sulla pagina 1di 10

Module 6

ActiveFactory Query
Section 1 – Introduction 6-3
Lab 12 – Use ActiveFactory Query 6-9
Lab 13 – Use ActiveFactory Query in Excel 6-23
6-2 Module 6 – ActiveFactory Query

Module Objectives
z Introduce ActiveFactory Query.
z Introduce, explain, and use Query to retrieve specific tag information.

Wonderware Training
Section 1 – Introduction 6-3

Section 1 – Introduction

Section Objective
z Understand ActiveFactory Query uses and operation.

This section explains the ActiveFactory Query uses and operations.

Introduction

ActiveFactory Query provides a point and click interface to construct and analyze the execution
of the queries specifically designed for the Historian.
Query provides an efficient and simple method to develop simple and complex queries for
reporting and custom application requirements. It is also an excellent way to learn the proper
syntax for developing queries for the Historian.
Query provides a “point-and-click” interface to build Structured Query Language (SQL) queries for
your reporting and custom application requirements. The query results are immediately available.
Query dynamically reconstructs and tests queries as the user makes changes. Query has easy
access to Historian data and thus provides easy construction of the SQL queries to perform tag
searches, obtain tag details, server information, and values (current, history, aggregate, summary,
and event snapshots).
This application supports construction of queries for use against the Historian version7.1 and later.
Query also utilizes and understands Historian custom extensions.
You can save queries to run at a later time, and you can also save results.

Query Operation
Numerous distinct query types can be selected from the query tool bar. These include custom
queries, and the Favorite Folder queries.
Each query selection results in a different workspace panel selection. The tag picker is present for
most query types. However, the selection panel for columns changes with the query type.
The Server dialog box contains all the servers that are configured in the Servers’ list configuration.
Changing the selected server in the server list will cause a corresponding change in the selected
server in the tag picker, and vice-versa.
The Database selection field is only enabled for the Custom query type. For all other queries, the
selected database is fixed to be the Runtime database.

Start Query
From the Start button on the Windows Taskbar, select All Programs / Wonderware /
ActiveFactory / Query. Before this client application can be used to query tag information from
the database, the server must be running and you must have access to the server.

Wonderware System Platform Course - Part 2


6-4 Module 6 – ActiveFactory Query

Note: Running any of the ActiveFactory applications for the first time will start the Server Setup
Wizard in order to connect to a server. The Wizard needs to run only once per server. Enter your
sa password to connect to your selected Historian. The Server Setup routine installs essential
server-side components as well as a promotional (45 day) license if there is no license already
installed.

Query Interface
The Query application consists of the following:
z The main Toolbar
z Query Type panel
z The TagPicker
z Columns panel (dynamic)
z Results panel

Wonderware Training
Section 1 – Introduction 6-5

Building Queries
The ActiveFactory Query Column Panel displays different tabs dependent upon the type of query
selected. Each tab provides various relevant configuration options to build your query.
The query is displayed in the SQL tab field. The query content is updated when each option is
selected.
The query results are displayed in the Data tab field. The results change dynamically whenever
the query itself is re-defined. To refresh your results use the Refresh button in the main toolbar.
The following table lists the available query types and the tag types available within the TagPicker
pane:

Query Types Description/Available Tags/Column/Tabs


Aggregate Use this to see aggregated (min, max, sum, average etc.) values of the tags that you
Values specify.
• Tag Filter Options: Analog, Discrete.
• Columns/Tabs: Format, Time, Criteria, Calculations, Retrieval, Source.
Alarm History For the query type Alarm History, there are two tag types: Analog and All.
• Tag Filter Options:
• Columns/Tabs: Columns, Time, Alarm limits, Retrieval, Source, Order
Alarm Limits Live Values:
• Tag Filter Options: Analog.
• Columns/Tabs: Alarm limits
Annotations Returns any annotations.
• Tag Filter Options: Analog, Discrete, String, Event.
• Columns/Tabs: Criteria, Time
Custom Construct your own query and view the results.
• Tag Filter Options: N/A
• Columns/Tabs: None (editor field)
Event history Returns times of specified events (when they occurred).
values
• Tag Filter Options: Event.
• Columns/Tabs: Columns, Time, Order
Event Return the values of snapshot tags associated with events at the time that the events
Snapshot occur.
• Tag Filter Options: Event. Select Analog, Discrete, String tag type.
• Columns/Tabs: Tag set, Columns, Time, Order
Favorite Sample files containing advanced queries that leverage more complex SQL.
• Tag Filter Options: N/A
Select from these queries to learn SQL that does not appear in the standard query
options. Modify the queries and re-save for future use in your environment.
• Columns/Tabs: Favorites (Browser/ellipsis button)
History values Returns the history of the tag values over time for specified tags.
Includes format configuration, and all the Historian time domain extensions. Specify a
wide range of criteria under which data is returned.
• Tag Filter Options: Analog, Discrete, String, All.
• Columns/Tabs: Columns, Time, Format, Criteria, Retrieval, Source, Order

Wonderware System Platform Course - Part 2


6-6 Module 6 – ActiveFactory Query

Query Types Description/Available Tags/Column/Tabs


IO Server Build queries to return list of tags, including summary tags.
• Tag Filter Options: N/A
• Columns/Tabs: IO Server
Live values Returns the real time value of specified tags.
• Tag Filter Options: Analog, Discrete, and String, All.
• Columns/Tabs: Columns, Time
Number of Returns the number of tags by type.
tags
• Tag Filter Options: Analog, Discrete, String, Event, All.
• Columns/Tabs: Count
Server version Returns current server version of target server selected from the Server drop-down list.
• Tag Filter Options: N/A
• Columns/Tabs: None
Storage Returns statistics for Storage Type, Path, Max and Min size thresholds.
• Tag Filter Options: N/A
• Columns/Tabs: Storage
Storage size Returns available storage space value on Alternate, Buffer, Main, and Permanent
available storage locations.
• Tag Filter Options: N/A
• Columns/Tabs: None
Storage start Returns earliest start date from v_HistoryBlock table.
date
• Tag Filter Options: N/A
• Columns/Tabs: None
Summary Use this to see the values calculated by the summary system of the tags that you specify.
values
• Tag Filter Options: All.
• Columns/Tabs: Columns, Time, Calculations, Order
Tag details Obtains the configuration information about the tags that you specify. Configuration
information defines how a tag is acquired, stored and displayed by default.
• Tag Filter Options: Analog, Discrete, String, Event.
• Columns/Tabs: Columns
Tag search Returns TagName and Description for selected tag type.
• Tag Filter Options: Analog, Discrete, String, Event, Summary.
• Columns/Tabs: Search
Time running Returns the total time (in minutes) the system has been running.
• Tag Filter Options: N/A
• Columns/Tabs: None

Wonderware Training
Section 1 – Introduction 6-7

Building Queries
The ActiveFactory Query interface displays different tabs dependent upon the type of query
chosen. Each tab provides various options from which to select in order to build your query.
As each of these options are chosen, the query being constructed can be viewed in the window
when the Query tab is selected. The query will change as each option is selected.
The query results are viewed in the Data tab. The results change dynamically whenever the query
itself is re-defined. To refresh your results use the Refresh button in the main toolbar.

You can also keep a record of all the queries constructed. Choose the Options / Show All
Queries selection from the main menu, and a third tab named All Queries appears. Once this
option is enabled, all queries constructed can be viewed in the window of this tab.

Configuration Options
You can refresh the query results by clicking the Data tab, then clicking the Refresh query button
on the main toolbar.
ActiveFactory Query includes an option that records all of the queries. To assist in creating a
report, any query can be saved and referred to at a later time.
Click Options / All Queries from the ActiveFactory main menu. The All Queries tab field will
display all subsequent queries and make them available to be copied/pasted into other
applications, or saved to a Queries folder. If you click the All Queries tab, the results may take a
long time to display.

Wonderware System Platform Course - Part 2


6-8 Module 6 – ActiveFactory Query

– Intentionally left blank –

Wonderware Training
Lab 12 – Use ActiveFactory Query 6-9

Lab 12 – Use ActiveFactory Query

Introduction
In this lab, ActiveFactory Query is used to demonstrate the ease of constructing SQL queries to
return Historian process data.

Objective
To complete this lab, the following tasks must be completed successfully:
z Start Query
z Create SQL Queries and View the Results

Wonderware System Platform Course - Part 2


6-10 Module 6 – ActiveFactory Query

Start Query
Use ActiveFactory Query to create SQL Queries and View the Results
1. From the Start button on the Windows Taskbar, select All Programs / Wonderware /
ActiveFactory / Query.

Your Historian should use the last or current active Server connection. If not, select Options /
Servers from the main menu and reconfigure a connection to your Historian.
Query 1 – Simple Query
2. Click your Historian in the Servers pane of the Tag Picker.

3. Select Custom from the Query type drop-down field.


4. Insert the cursor into the SQL pane.
5. Enter the following query:

SELECT * FROM Tag


6. Click the Data tab.

Wonderware Training

Potrebbero piacerti anche