0% found this document useful (0 votes)
119 views5 pages

Hyper Historian - SQL Query Engine Quick Start

Sql setting iconics

Uploaded by

Mido Ellaoui
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
119 views5 pages

Hyper Historian - SQL Query Engine Quick Start

Sql setting iconics

Uploaded by

Mido Ellaoui
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Hyper Historian – SQL Query Engine Quick Start

Application Note February 2021

Description: Quick start document to use the SQL query engine


in Hyper Historian.

General Requirement: Microsoft SQL Server, ICONICS Hyper


Historian SQL Query Engine installed.

Introduction
Hyper Historian logs data to a proprietary (.HHD) file format.
While you can use the TrendWorX64 and TrendWorX32 Viewers
to see and edit your logged data in a graphical format, you may
wish to create reports for the logged data or edit data in bulk.
For this reason, Hyper Historian comes with a SQL Query Engine
Figure 1 - Hyper Historian Provider
that allows you to use common SQL Data Manipulation
Language (DML) queries to retrieve and edit data.
Building SQL Queries
NOTE: For more information on the tables and stored procedures that
can be queried using the Hyper Historian SQL Query Engine, see the In this example, you will use a simple SQL command that reads
Help Files under Hyper Historian → Reporting Options → “SQL Query
Engine Quick Start” and “SQL Query Engine”.
the list of all the tags available in one of the Hyper Historian
Logging Groups. Additionally, you will also create another
simple query to retrieve logged data related to a selected tag.
Hyper Historian Linked Server
To see if the ICONICS Hyper Historian Linked Server is already
present, use the following steps in SQL Server Management
Studio.

1. Open SQL Server Management Studio.


2. Connect to your local SQL server.
3. In the Object Explorer on the left, expand Server Objects.
4. Double-click on Linked Servers to expand it. You should
now see a linked server called HH2, which stands for Hyper
Historian.
5. Expand the Providers folder. You will discover a provider
called ICONICS.HHOleDbProvider, which is necessary for
your queries to work. Figure 2 - Collector Group

NOTE: This example uses the collector group named “Signals” from the
sample Hyper Historian configuration. The display name is “Various
Signals”, but the name of the group is “Signals”.

1. Click on the New Query button, located in the standard


toolbar of Microsoft SQL Server Management Studio.
2. In the SQL Editor that opens, write the following query:

select * from openquery(HH2, 'select * from


signals.tags')

3. Click the Execute button in the SQL Editor Toolbar. You will
see a result for the query similar to Figure 3.

© 2021 ICONICS, Inc. Page 1 of 5 Hyper Historian - SQL Query Engine Quick Start
Hyper Historian – SQL Query Engine Quick Start

Application Note February 2021

Figure 3 – Retrieving Tag Names

NOTE: If you get no results for the query, you probably have no logged
data. Open Hyper Historian (with the sample configuration) and go into
runtime mode. Then repeat step 3.

Figure 5 - New Data Connection


4. Now select one of the tag names, and query the RAWDATA
table. This will list all the logged values for the specified tag:
4. Choose “Other/Advanced” data source and click Next.
select * from openquery(HH2, 'select * from 5. Select ICONICS HyperHistorian SQL Query Engine and
signals.rawdata where tagname =''Ramp''') click Next.

Figure 4 - Logged Data for the Ramp Tag

SQL Clients – Microsoft Excel Figure 6 - Selecting Hyper Historian SQL Query Engine

The Hyper Historian SQL Query Engine can also be used in other 6. On the Connection properties table, enter the
containers like Microsoft Excel. The following steps describe how “HyperHistorian URL” for a remote Hyper Historian Server
to get Hyper Historian data in Excel. or leave it blank (empty) for local server. Select the Catalog
“!Root” and Schema “!All” and press OK.
1. Open Excel.
2. In the Data tab, click the “From Other Sources” button.
3. Select “From Data Connection Wizard” option.

© 2021 ICONICS, Inc. Page 2 of 5 Hyper Historian - SQL Query Engine Quick Start
Hyper Historian – SQL Query Engine Quick Start

Application Note February 2021

Figure 9 - Data Connection Wizard

10. The Import Data properties dialog will appear. Click OK,
leaving all the default selections.
Figure 7 - Selecting Hyper Historian Server

NOTE: If you get an error message after clicking OK, check to see if your
version of Microsoft Excel is 32-bit or 64-bit. There are known issues
with Hyper Historian interacting with 64-bit Microsoft Office. Try
installing a 32-bit version of Microsoft Excel and repeat step 6.

7. You will see Database and Table pop-up. Select “!Root”


from the dropdown. A list of tables appears as shown in
Figure 8.
Figure 10 - Import Data Dialog

The result of the query will look like the following:

Figure 11 – HH “Tags” Names

Figure 8 - Selecting Table


To get a list of values for your tags, repeat these steps but
8. Select the TAGS table, then click Next. choose the RAWDATA table in step 8.
9. The Data Connection Wizard window appears. Configure
the name and description for your data connection file. Click
Finish.

© 2021 ICONICS, Inc. Page 3 of 5 Hyper Historian - SQL Query Engine Quick Start
Hyper Historian – SQL Query Engine Quick Start

Application Note February 2021

Figure 12 – RAWDATA (Signals)

Figure 14 - Modifying Existing Connection MS Excel

2. The Import Data Window will appear. Click on Properties.

Figure 13 - RAWDATA (Signals) Data in Microsoft Excel

Retrieving Data for a Single Hyper Historian Tag in


Excel
To get data for only a single tag, modify your existing connection
and change the “Command” details for Connection Properties.

1. Open Excel, go to the Data ribbon, select Existing Figure 15 - Properties of an Existing Connection

Connections, choose your Hyper Historian connection and


press Open. 3. Select the Definition Tab. Change the Command Type
from “Table” to “SQL” and change the Command Text to
your SQL statement, such as:

SELECT * FROM Signals.RawData


WHERE TagName = 'Ramp' AND Timestamp BETWEEN
'01/01/2021 00:00:00' AND '01/28/2021
00:00:00'

© 2021 ICONICS, Inc. Page 4 of 5 Hyper Historian - SQL Query Engine Quick Start
Hyper Historian – SQL Query Engine Quick Start

Application Note February 2021

show the new method to retrieve Hyper Historian SQL Query


engine data.

1. Open Excel
2. On the Data tab, select Get Data → From Other Sources →
From OLEDB
3. In the new dialog, select the Build button to open the
OLEDB connection string window
4. On the provider tab select ICONICS HyperHistorian SQL
Query Engine
5. Click Next
6. On the Connection properties table, enter the
“HyperHistorian URL” for a remote Hyper Historian Server
or leave it blank (empty) for local server, select the Catalog
“!Root” and Schema “!All” and press OK.
7. In the “From OLE DB” dialog expand Advanced Options and
insert the query below:

SELECT * FROM Signals.RawData


WHERE TagName = 'Ramp' AND Timestamp BETWEEN
'01/01/2021 00:00:00' AND '01/28/2021 00:00:00'
Figure 16 - Connection Properties /Command Type/Text

NOTE: The time range in this query is in UTC and may need to be
4. Press OK until you return to Excel. Your data table should updated to a more recent time
now show you the History for a single tag.
8. Click OK
9. In the next dialog a preview of the data will show. Now click
on Load and the data will show in the Excel sheet.

Figure 17 - History for a single tag (Ramp)

Retrieving data with newer versions of Excel


In newer versions of Excel, the Data Connection Wizard has been
removed for other methods to retrieve data. The steps below

© 2021 ICONICS, Inc. Page 5 of 5 Hyper Historian - SQL Query Engine Quick Start

You might also like