87
https://support.industry.siemens.com/cs/ww/de/view/64906050 Application Example 03/2018 Creation of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process Historian

Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

Embed Size (px)

Citation preview

Page 1: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

https://support.industry.siemens.com/cs/ww/de/view/64906050

Application Example 03/2018

Creation of report templates for the

Information Server based on

Process Historian data WinCC, PCS 7, Information Server, Process Historian

Page 2: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

Warranty and liability

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 2

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Warranty and liability

Note The Application Examples are not binding and do not claim to be complete regarding the circuits shown, equipping and any eventuality. The Application Examples do not represent customer-specific solutions. They are only intended to provide support for typical applications. You are responsible for ensuring that the described products are used correctly. These Application Examples do not relieve you of the responsibility to use safe practices in application, installation, operation and maintenance. When using these Application Examples, you recognize that we cannot be made liable for any damage/claims beyond the liability clause described. We reserve the right to make changes to these Application Examples at any time without prior notice. If there are any deviations between the recommendations provided in these Application Examples and other Siemens publications – e.g. Catalogs – the contents of the other documents have priority.

We do not accept any liability for the information contained in this document. Any claims against us – based on whatever legal reason – resulting from the use of the examples, information, programs, engineering and performance data etc., described in this Application Example shall be excluded. Such an exclusion shall not apply in the case of mandatory liability, e.g. under the German Product Liability Act (“Produkthaftungsgesetz”), in case of intent, gross negligence, or injury of life, body or health, guarantee for the quality of a product, fraudulent concealment of a deficiency or breach of a condition which goes to the root of the contract (“wesentliche Vertragspflichten”). The damages for a breach of a substantial contractual obligation are, however, limited to the foreseeable damage, typical for the type of contract, except in the event of intent or gross negligence or injury to life, body or health. The above provisions do not imply a change of the burden of proof to your detriment. Any form of duplication or distribution of these Application Examples or excerpts hereof is prohibited without the expressed consent of the Siemens AG.

Security informa-tion

Siemens provides products and solutions with industrial security functions that support the secure operation of plants, systems, machines and networks. In order to protect plants, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art industrial security concept. Siemens’ products and solutions only form one element of such a concept. Customer is responsible to prevent unauthorized access to its plants, systems, machines and networks. Systems, machines and components should only be connected to the enterprise network or the internet if and to the extent necessary and with appropriate security measures (e.g. use of firewalls and network segmentation) in place. Additionally, Siemens’ guidance on appropriate security measures should be taken into account. For more information about industrial security, please visit http://www.siemens.com/industrialsecurity.

Siemens’ products and solutions undergo continuous development to make them more secure. Siemens strongly recommends to apply product updates as soon as available and to always use the latest product versions. Use of product versions that are no longer supported, and failure to apply latest updates may increase customer’s exposure to cyber threats. To stay informed about product updates, subscribe to the Siemens Industrial Security RSS Feed under http://www.siemens.com/industrialsecurity.

Page 3: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

Table of contents

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 3

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Table of contents Warranty and liability ................................................................................................... 2

1 Preface ................................................................................................................ 5

2 Task ..................................................................................................................... 6

3 Solution............................................................................................................... 7

3.1 Process Historian ................................................................................. 7 3.1.1 Overview of the functionalities and advantages ................................... 8 3.1.2 Operating principle of the Process Historian ........................................ 8 3.1.3 Data transmission between OS server and Process Historian ............ 9 3.2 Information Server ................................................................................ 9 3.3 Report creation with the Information Server....................................... 10 3.3.1 Report templates ................................................................................ 10 3.3.2 Projects............................................................................................... 10

4 The report templates of the Information Server ........................................... 11

4.1 Siemens.InformationServer.Common.External Resources ............... 11 4.2 Information Server parameters .......................................................... 13 4.2.1 General parameters ........................................................................... 13 4.2.2 Parameters for report templates with tags ......................................... 22 4.2.3 Parameters for report templates with messages ............................... 25 4.3 Tool for report creation ....................................................................... 34 4.4 Installation of Report Builder using the Report Manager ................... 34 4.4.1 Report Builder user interface.............................................................. 36 4.4.2 Connecting Report Builder to the Report Server ............................... 37 4.4.3 Editing a report template .................................................................... 38 4.4.4 Testing standard report templates with Report Builder ...................... 39 4.4.5 Exporting a report template and changing the name ......................... 40 4.4.6 Calculations ........................................................................................ 42 4.4.7 Direct SQL statements in Report Builder ........................................... 43 4.5 Date and time ..................................................................................... 44 4.5.1 Examples of time functions ................................................................ 45 4.5.2 Conversion of time stamps to local time ............................................ 46

5 Working with the database ............................................................................. 48

5.1 OS archive tags .................................................................................. 48 5.1.1 IS.VTagBrowsing ................................................................................ 48 5.1.2 TLG.VTagValue .................................................................................. 48 5.1.3 Designing SQL queries at the database level .................................... 49 5.2 Working with stored procedures of the Information Server

database schema ............................................................................... 50 5.2.1 Example "udsp_getTagTable" ............................................................ 50 5.2.2 Example "udsp_getTagTrend" ........................................................... 51 5.2.3 Example "udsp_getTagAggregetion" ................................................. 52 5.2.4 Example "udsp_GetMessagesPerDay" .............................................. 54 5.2.5 Example "udsp_getMessagesPer10Minutes" .................................... 55 5.2.6 Example "udsp_ getQuantityByMessageClass"................................. 55 5.2.7 Example "udsp_ getQuantityByMessageClass"................................. 56

6 Glossary ........................................................................................................... 57

7 Appendix .......................................................................................................... 58

7.1 Service and Support ........................................................................... 58 7.2 Links and Literature ............................................................................ 59 7.3 Change documentation ...................................................................... 59 7.4 Appendix: Technical specifications .................................................... 59

Page 4: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

Table of contents

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 4

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

A Information Server Stored Procedures ......................................................... 60

A.1 Common Parameters ......................................................................... 60 A.1.1 @lcid .................................................................................................. 60 A.1.2 @projectGuid ..................................................................................... 60 A.2 General Functions .............................................................................. 61 A.3 Alarm Logging .................................................................................... 61 A.3.1 [IS].[udf_TextBlock] ............................................................................ 61 A.3.2 [IS].[udf_ getMessageDefinitions] ...................................................... 63 A.3.3 [IS].[udf_getAlarmDefinitions] ............................................................. 63 A.3.4 [IS].[udsp_ getAcknowledgeableMessageClasses] ........................... 65 A.3.5 [IS].[udsp_ getMessageClasses] ........................................................ 65 A.3.6 [IS].[udsp_ getPercentageOfPriorityInAlarmSettings] ........................ 66 A.3.7 [IS].[udsp_ getDurationOfAckn] .......................................................... 67 A.3.8 [IS].[udsp_getMessagesPerDay] ........................................................ 67 A.3.9 [IS].[udsp_ getPercentageOfPriorityInRTAlarms] .............................. 68 A.3.10 [IS].[udsp_getMessagesPer10Minutes] ............................................. 68 A.3.11 [IS].[udsp_getAlarmsByPriority] ......................................................... 69 A.3.12 [IS].[udsp_getQuantityByMessageClass] ........................................... 69 A.3.13 [IS].[udsp_ getTotalDurationUntilAcknowledgment] ........................... 70 A.3.14 [IS].[udsp_ getTotalDurationUntilWent] .............................................. 70 A.3.15 [IS].[udsp_getAlarmsByOrigin] ........................................................... 71 A.3.16 [IS].[udsp_getMessageTable] ............................................................ 72 A.3.17 [IS].[udsp_ getAverageDurationOfAckn] ............................................ 74 A.4 Tag Logging ....................................................................................... 75 A.4.1 [IS].[VTagBrowsing] ............................................................................ 75 A.4.2 [IS].[udf_getTagAggregation] ............................................................. 76 A.4.3 [IS].[udf_getTagTrend] ....................................................................... 77 A.4.4 [IS].[udsp_getCalculationValues] ....................................................... 78 A.4.5 [IS].[udsp_getResolutionValues] ........................................................ 79 A.4.6 [IS].[udsp_getSingleValueLastNext] ................................................... 79 A.4.7 [IS].[udsp_getTagTableWithoutName] ............................................... 80 A.4.8 [IS].[udsp_getTagNamesById] ........................................................... 80 A.4.9 [IS].[udsp_getTagParameterByld] ...................................................... 80 A.4.10 [IS].[udsp_getTagConfiguration] ........................................................ 81 A.4.11 [IS].[udsp_getTagConfigurationChain] ............................................... 82 A.4.12 [IS].[udsp_getTagAggregation] .......................................................... 83 A.4.13 [IS].[udsp_getTagTrend]..................................................................... 84 A.4.14 [IS].[udsp_getTagTable] ..................................................................... 84 A.4.15 [IS].[udsp_getUnitOfTags] .................................................................. 86

Page 5: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

1 Preface

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 5

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

1 Preface

Application objective

This application describes the basics and the operating principle of the Process Historian (PH) and the Information Server (IS).

It explains in detail how you create customized reports that allow you to read data from the PH database in a timely manner.

You will also learn how to work with the Process Historian database.

Key contents of this application example

The following key items are addressed in this documentation:

Explanation of the basics and operating principle of the Process Historian

Description of Report Builder (tool for report creation)

Correct working with the PH database

Explanation of stored procedures of the Process Historian

Validity

SIMATIC Process Historian 2014, 2013, V8.0

SIMATIC Information Server 2014, 2013, V8.0

SIMATIC PCS 7 V9.0, V8.2, V8.1, V8.0

WinCC V7.4, V7.3, V7.0

Page 6: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

2 Task

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 6

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

2 Task Global competition, rising energy costs, scarce raw materials and high product quality requirements – process industry companies face a host of challenges. Specific optimization regarding process excellence and profitability is essential.

Historical data from the plant supplies one key to increased productivity. Tapping into the huge data volumes for plant optimization requires a powerful archiving and reporting system.

The following requirements must be met for this:

Availability and security of data

Aggregation of process-relevant information by company-wide production reporting systems

Central archiving of process data, tags, alarms and batch data from SIMATIC BATCH without additional engineering effort as well as comprehensive, long-term and reliable data acquisition

Task-specific report creation and visualization of data

Powerful data extraction to Microsoft Excel

Flexible creation and editing of report templates

Standard reporting systems

The following figure provides an overview of the automation task:

Page 7: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

3 Solution

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 7

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

3 Solution

3.1 Process Historian

The PCS 7 Process Historian (PH) is a long-term archive server for process data. Tags, alarms and SIMATIC BATCH data can be archived on the Process Historian. The Process Historian uses the SQL Server as data storage. The Microsoft Reporting Services can be used for preparation of the SQL Server data. The Information Server makes data of the PH available to the user via a web interface.

The Process Historian and Information Server components can also be installed on the same computer.

The following figure shows an overview of the operating principle of the Process Historian and Information Server in the PCS 7 environment:

Figure 3-1: Operating principle of PH and IS

Page 8: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

3 Solution

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 8

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

1. Timely data storage of OS single stations and the OS server on the Process Historian

2. Export of batch data from SIMATIC BATCH to the PH

3. Access of Information Server clients to the Information Server for creation of reports

Published reports can be displayed and configured on a computer using the browser.

With the help of MS Excel and an Information Server plug-in for Excel, you can extract data from the PH to Excel on a computer.

The data of multiple WinCC projects/multi-projects/PCS 7 projects can be archived on a Process Historian.

3.1.1 Overview of the functionalities and advantages

The Process Historian (PH) and Information Server (IS) include the following functions:

All OS process data is available in the Process Historian in a timely manner.

Batch archives of SIMATIC BATCH are stored in a native way on the Process Historian.

The PH supports both single stations and redundant systems.

The PH supports multiple PCS 7 projects and WinCC projects in parallel.

Easy access to historical process data via web and Office applications.

Widely used standard reporting system adapted to PCS 7 reporting including standard report templates.

The PH can be easily integrated in existing IT infrastructures and web portals.

Large quantities of process data can be displayed in reports.

With the WinCC Trend and Alarm Control, data of the PH can be displayed on the OS Runtime level.

PH data can be accessed with the OPC UA server.

Backup/restore function to/from external data carriers.

3.1.2 Operating principle of the Process Historian

All OS servers and OS single stations for which a Process Historian is configured in the WinCC or PCS 7 project export alarms to the PH during runtime. In addition, all alarms that occur on the OS server/OS single station are stored in the circulating archive of the OS. The local archive is configured using the Alarm Logging of the OS.

If a PH is configured in the WinCC or PCS 7 project, all OS archive tags that have the "long term archiving" identifier in Tag Logging are archived on the PH during runtime (real-time). In addition, all archive tags are stored in the local circulating archive of the OS. The local archive is configured using the Tag Logging of the OS.

Calculations, post-editing functions and reporting functions are run on the Process Historian.

The data archived in the PH can be read and written via standard database interfaces. For example, ODBC, OLE DB and ADO.NET are supported.

Page 9: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

3 Solution

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 9

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

3.1.3 Data transmission between OS server and Process Historian

At the start of OS Runtime, the configuration data of the OS server/OS single station is transferred to the database of the Process Historian. The alarms that occur on the OS server are transferred to the PH in a timely manner. The locally archived OS tags are also promptly transferred to the PH in the archiving cycle.

When a redundant OS server is present, data storage in the PH is always performed from the master OS.

3.2 Information Server

Reports are created with the Information Server using templates. The report templates can be customized to create user-defined reports. Archived tags, messages and SIMATIC BATCH data can be displayed in the reports. Reports can be automatically generated and sent to a specified email address.

Information Server client

An Information Server client can be an Internet-capable browser or an MS Excel, MS PowerPoint or MS Word application. If language changeovers are desired, the languages must be installed on the operating system side.

Operating principle of the Information Server

The Information Server is the SIEMENS front-end of the Process Historian. The IS makes the data of the Process Historian database available to the user with the help of MS Internet Information Services (IIS).

Reporting Services and Process Historian

The Process Historian system is based on MS SQL Server 2014

SP1. With the purchase of the Process Historian, the customer also receives MS Reporting Services. MS Reporting Services can be used by the customer for creation of reports. Appropriate knowledge of Microsoft is needed to use Reporting Services.

Knowledge of Reporting Services is necessary if you want to create and customize report templates in RDL format.

Use of MS Reporting Services on the MS SQL Server platform is not mandatory. All functionalities of the Information Server can be used without knowledge of Microsoft Reporting Services.

Page 10: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

3 Solution

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 10

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

3.3 Report creation with the Information Server

You can use the SIMATIC Information Server to collect, evaluate and graphically display measured values and messages. A network connection to a Process Historian is needed in order to access archived data. A network connection is not needed if the Information Server and Process Historian are installed on the same PC.

You access the Information Server with an Internet-capable browser. You use the web both for displaying reports and for administering the Information Server. The contents of reports can be displayed as graphics or tables.

The Information Server is an ASP.Net application.

3.3.1 Report templates

Report templates are included with the Information Server. The report templates are described in the "Information Server Documentation" manual.

You can create reports with the help of report templates. The reports can be saved in PDF, Word or Excel format.

3.3.2 Projects

The Information Server 2014 SP2 can connect the following projects: Process Historian (PCS 7, WinCC, Batch), WinCC V7 and WinCC OA.

For each created project, a new database is created that operates as a local proxy. In addition, a linked server is set up for a project that is located on another computer. If the project is provided with redundancy, a second linked server may be set up for the redundancy computer.

If the stored procedures, views or functions of the proxy database are used, the queries are automatically forwarded to the correct project. The

"GetProjectCatalog" function allows you to determine the correct proxy database from a report template and to execute queries on this database.

Page 11: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 11

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

4 The report templates of the Information Server In addition to the functions of Microsoft Reporting Services, the IS provides its own parameters and methods. This is used to internationalize report parameters, call special browsers (archive tags, batches), use IS projects and cover redundancy of projects.

4.1 Siemens.InformationServer.Common.External Resources

The ExternalResources assembly offers all support methods. The ExternalResources assembly is loaded by the Microsoft Reporting Services and can be used in the report templates.

The following methods are provided:

public static string GetString(string resourceName, string

culture):

GetString gets the name of a predefined report parameter and the desired language (as Windows country code) and returns the name translated into this language.

Example: GetString("Project",“en-us“) returns "Project" and

GetString("Project",“de- de“) returns "Projekt"

public static string GetCultureName(int culture):

Gets the lcid of a country and returns the country code needed for the GetString function.

Examples: GetCultureName(1033): "en-us", GetCultureName(1031): "de-de"

public static string GetLCID(string culture):

Gets the country code and returns the associated lcid: Examples

GetLCID("en-us"): 1033, GetLCID("de-de"): 1031

public static string GetProjectCatalog(string

datasourceIdString):

This important function "maps" the project ID onto the correct proxy database. The redundancy of projects is also covered with this function.

A typical example:

DECLARE @stmt varchar(4000)

SET @stmt = 'exec [' +

Helper.GetProjectCatalog(Parameters!Project.Value)

+ '].[IS].udsp_TestConnection'

EXEC (@stmt) GetProjectCatalog(Parameters!Project.Value)

To avoid having to use the complete namespace every time in the calls, it is recommended that proxy functions be written and used for the above functions.

<Code>

Public Function GetString(name as String, userLanguage as String) as

String Return

Siemens.InformationServer.Common.ExternalResources.Localization.GetS

tring(name, userLanguage)

End Function

Page 12: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 12

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Public Function GetLcid(userLanguage as String) as String Return

Siemens.InformationServer.Common.ExternalResources.Localization.GetL

CID(userLang uage)

End Function

Public Function GetProjectGuid(project as String) as String Return

Siemens.InformationServer.Common.ExternalResources.Helper.GetProject

Guid(projec t)

End Function

Public Function GetConnectionString(project as String) as String

Return

Siemens.InformationServer.Common.ExternalResources.Helper.GetConnect

ionString(p roject)

End Function

</Code>

<CodeModules>

<CodeModule>Siemens.InformationServer.Common.ExternalResources</Code

Module

>

</CodeModules>

Page 13: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 13

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

4.2 Information Server parameters

The report parameters provided by the IS are listed below. All of these parameters can be localized by the "GetString" function.

4.2.1 General parameters

Localization parameter

Together with the "GetString" function, this String type parameter is responsible for the mentioned localization of report parameters. It can contain multiple values in the following format: "Parameter Name_Translated Parameter Name". The Information Server parses these strings and can thus display the parameters as localized parameters. The Name and Desc parameters are special keywords that are to contain the name of the report template and its description.

Example:

To change a "default" value of the Localization parameter, you have to change the expression of the value:

The XML configuration of the parameter is shown below.

<ReportParameter Name="Localization">

<DataType>String</DataType>

<DefaultValue>

<Values>

<Value>= "Name_" +

Code.GetString("Tlg_Chart_Aggregation_LocalName",User!Language)</Val

ue>

Page 14: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 14

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

<Value>= "Project_" +

Code.GetString("Project",User!Language)</Value>

<Value>= "TimeBegin_" +

Code.GetString("TimeBegin",User!Language)</Value>

<Value>= "TimeEnd_" +

Code.GetString("TimeEnd",User!Language)</Value>

<Value>= "Desc_" +

Code.GetString("Tlg_Chart_Aggregation_LocalDesc",User!Language)</Val

ue>

<Value>= "Aggregation_" +

Code.GetString("Aggregation",User!Language)</Value>

<Value>= "Timestep_" +

Code.GetString("Timestep",User!Language)</Value>

</Values>

</DefaultValue>

<AllowBlank>true</AllowBlank>

<Prompt>Localization</Prompt>

<Hidden>true</Hidden>

<MultiValue>true</MultiValue>

</ReportParameter>

If your own parameters are to be displayed as localized parameters, they must also be contained as a value in the Localization parameter. Only the "GetString" function cannot be used. The translation can be stored "hard-coded" in the report template.

Project parameter

The Project parameter is a string parameter and is useful only in combination with a dataset that uses the "udf_GetProjects" function in order to determine all existing IS projects that can use the report template. The Project parameter must be linked to the field of this dataset that contains the determined project name.

Page 15: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 15

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

<ReportParameter Name="Project">

<DataType>String</DataType>

<Prompt>Project</Prompt>

<ValidValues>

<DataSetReference>

<DataSetName>Project</DataSetName>

<ValueField>Project</ValueField>

<LabelField>ProjectName</LabelField>

</DataSetReference>

</ValidValues>

</ReportParameter>

This determines all projects that correspond to the following types:

'PH Pcs7','PH WinCC', 'PH Batch','WinCC','Pcs7','PerformanceMonitor'

Page 16: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 16

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

<DataSet Name="Project">

<Query>

<DataSourceName>InfoServer</DataSourceName>

<CommandText>Select projectName, project from udf_GetProjects()

where typeName in ('PH Pcs7','PH WinCC', 'PH

Batch','WinCC','Pcs7','PerformanceMonitor')</CommandText>

</Query>

<Fields>

<Field Name="ProjectName">

<DataField>ProjectName</DataField>

<rd:TypeName>System.String</rd:TypeName>

</Field>

<Field Name="project">

<DataField>Project</DataField>

<rd:TypeName>System.String</rd:TypeName>

</Field>

</Fields>

</DataSet>

Page 17: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 17

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

“LanguageID” parameter

The "LanguageID" parameter contains the Icid for the current time zone information of the Information Server. This parameter is used to pass on this information to the queries.

<ReportParameter Name="LanguageID">

<DataType>Integer</DataType>

<DefaultValue>

<Values>

<Value>=Code.GetLcid(User!Language)</Value>

</Values>

</DefaultValue>

<Prompt>LanguageID</Prompt>

<Hidden>true</Hidden>

</ReportParameter>

Page 18: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 18

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

“TimeBegin” and “TimeEnd” parameters

These parameters are used to enter the start and end dates for the queries to be executed.

The IS represents the parameters as a collection of control elements in order to enter absolute and relative date and time values. If the user enters a relative date/time value, the IS converts the value to an absolute date/time value before the Report Service is called.

The snippet below shows a default value of two hours prior to the current time for TimeBegin.

<ReportParameter Name="TimeBegin">

<DataType>DateTime</DataType>

<DefaultValue>

<Values>

<Value>=DateAdd("h",-2,Now())</Value>

</Values>

</DefaultValue>

<Prompt>TimeBegin</Prompt>

</ReportParameter>

<ReportParameter Name="TimeEnd">

<DataType>DateTime</DataType>

<DefaultValue>

Page 19: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 19

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

<Values>

<Value>=DateAdd("h",-0,Now())</Value>

</Values>

</DefaultValue>

<Prompt>TimeEnd</Prompt>

</ReportParameter>

“Number” parameter

The "Number" parameter can be used to support the user with a predefined selection of integers. The English translation is "Number of items". The parameter can be easily adapted on a user-defined basis to represent any integer. The parameter can be used, for example, with the

udsp_getTotalDurationUntilAcknowledgment function.

Page 20: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 20

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

<ReportParameter Name="Number">

<DataType>Integer</DataType>

<DefaultValue>

<Values>

<Value>10</Value>

</Values>

</DefaultValue>

<Prompt>Number</Prompt>

<ValidValues>

<ParameterValues>

<ParameterValue>

<Value>10</Value>

<Label>10</Label>

</ParameterValue>

<ParameterValue>

<Value>20</Value>

<Label>20</Label>

</ParameterValue>

<ParameterValue>

<Value>30</Value>

<Label>30</Label>

</ParameterValue>

<ParameterValue>

<Value>40</Value>

<Label>40</Label>

</ParameterValue>

<ParameterValue>

<Value>50</Value>

<Label>50</Label>

</ParameterValue>

</ParameterValues>

</ValidValues>

<UsedInQuery>False</UsedInQuery>

</ReportParameter>

Page 21: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 21

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

“Sorting” parameter

The "Sorting" parameter supports the option of selecting the sorting order used in queries.

<ReportParameter Name="Sorting">

<DataType>String</DataType>

<DefaultValue>

<Values>

<Value>ASC</Value>

</Values>

</DefaultValue>

<Prompt>Sorting</Prompt>

<ValidValues>

<ParameterValues>

<ParameterValue>

<Value>ASC</Value>

<Label>=Code.GetString("asc",User!Language)</Label>

Page 22: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 22

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

</ParameterValue>

<ParameterValue>

<Value>DESC</Value>

<Label>=Code.GetString("desc",User!Language)</Label>

</ParameterValue>

</ParameterValues>

</ValidValues>

</ReportParameter>

4.2.2 Parameters for report templates with tags

“ParamTagIds” parameter

The IS supports a tag picker in order to select tags from different projects.

To indicate that a parameter is to be filled by the tag picker, the name of the "ParamTagIds" parameter is used. The value corresponds to a comma-separated string containing the Ids of the tags (Guids for PH tags, integers for WinCC tags).

The parameter can be used with udsp_getTagAggregation or udsp_getTagTrend.

<ReportParameter Name="ParamTagIds">

<DataType>String</DataType>

<Prompt xml:space="preserve"> </Prompt>

<MultiValue>true</MultiValue>

</ReportParameter>

</ReportParameters>

Page 23: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 23

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Figure 4-1: IS Tag Picker

“Aggregation” parameter

This parameter is used to select an aggregation function and pass it to a query.

The parameter can be used, for example, with the udsp_getTagAggregation

function.

Page 24: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 24

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

<ReportParameter Name="Aggregation">

<DataType>String</DataType>

<Prompt>Aggregation</Prompt>

<ValidValues>

<ParameterValues>

<ParameterValue>

<Value>AVG</Value>

<Label>=Code.GetString("Aggregation_8",User!Language)</Label>

</ParameterValue>

<ParameterValue>

<Value>MIN</Value>

<Label>=Code.GetString("Aggregation_4",User!Language)</Label>

</ParameterValue>

<ParameterValue>

<Value>MAX</Value>

<Label>=Code.GetString("Aggregation_5",User!Language)</Label>

</ParameterValue>

<ParameterValue>

<Value>SUM</Value>

Page 25: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 25

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

<Label>=Code.GetString("Aggregation_3",User!Language)</Label>

</ParameterValue>

</ParameterValues>

</ValidValues>

</ReportParameter>

“Timestamp” parameter

Some aggregation functions require an interval for further processing. The

"Timestep" parameter supports this interval. The unit of measurement is seconds.

The parameter can be used, for example, with the udsp_getTagAggregation

function.

<ReportParameter Name="Timestep">

<DataType>Integer</DataType>

<DefaultValue>

<Values>

<Value>60</Value>

</Values>

</DefaultValue>

<Prompt>Timestep</Prompt>

</ReportParameter>

“Filter” parameter

The "Filter" parameter is given a filter expression for use in queries.

The localized name for the "en-us" culture is "Tag Filter". This parameter can only be used for filtering tags.

The parameter can be used with the udsp_getTagConfiguration function.

<ReportParameter Name="Filter">

<DataType>String</DataType>

<DefaultValue>

<Values>

<Value>%</Value>

</Values>

</DefaultValue>

<AllowBlank>true</AllowBlank>

<Prompt>Filter</Prompt>

</ReportParameter>

</ReportParameters>

4.2.3 Parameters for report templates with messages

“MessageClasses” parameter

The "MessageClasses" parameter is used to select the message class for the executed queries.

Page 26: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 26

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

The parameter is used in combination with a dataset that receives the available message classes. This dataset can use the stored procedure

udsp_getMessageClasses.

The linked dataset:

Page 27: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 27

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Page 28: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 28

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Parameter “Grouped” (Meldeblöcke)

The "Grouped" parameter is used to display a selection of message blocks. The selected message group is used to group the result of this query:

udsp_getTotalDurationUntilAcknowledgment.

The parameter is used with a dataset that queries udf_TextBlock.

<ReportParameter Name="Grouped">

<DataType>String</DataType>

<DefaultValue>

<Values>

<Value>17</Value>

</Values>

</DefaultValue>

<Prompt>Grouped</Prompt>

<ValidValues>

<DataSetReference>

<DataSetName>DataSet2</DataSetName>

<ValueField>ID</ValueField>

<LabelField>Blockname</LabelField>

</DataSetReference>

</ValidValues>

</ReportParameter>

The linked dataset:

<DataSet Name="DataSet2">

<Query>

<DataSourceName>InfoServer</DataSourceName>

<QueryParameters>

<QueryParameter Name="@DataSource">

<Value>=Parameters!DataSource.Value</Value>

<rd:UserDefined>true</rd:UserDefined>

</QueryParameter>

<QueryParameter Name="@LanguageID">

<Value>=Parameters!LanguageID.Value</Value>

</QueryParameter>

<QueryParameter Name="@ProjectGuid">

<Value>=Parameters!ProjectGuid.Value</Value>

</QueryParameter>

</QueryParameters>

<CommandText> DECLARE @query varchar(4000)

SET @query = 'IF ((Select COUNT(ID) from [IS].[udf_TextBlock](' +

CAST( + @LanguageID AS nvarchar(5)) + ','''+ @ProjectGuid +'''))

&gt; 0)

begin

Select distinct ID, Text as Blockname from [IS].[udf_TextBlock](' +

CAST( + @LanguageID AS nvar- char(5)) + ','''+ @ProjectGUID +''')

where ID in (17,21,22,23,24,25,26,27,28,29,210)

Page 29: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 29

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

end else begin

Select distinct ID, Text as Blockname from

[IS].[udf_TextBlock](1033,'''+ @ProjectGUID +''') where ID in

(17,21,22,23,24,25,26,27,28,29,210)

end'

execute (@query)

</CommandText>

</Query>

<Fields>

<Field Name="ID">

<DataField>ID</DataField>

<rd:TypeName>System.Int32</rd:TypeName>

</Field>

<Field Name="Blockname">

<DataField>Blockname</DataField>

<rd:TypeName>System.String</rd:TypeName>

</Field>

</Fields>

</DataSet>

“SystemBlock” parameter

The "SystemBlock" parameter is used to display a selection of system blocks that can be used in message queries.

<ReportParameter Name="SystemBlock">

<DataType>String</DataType>

<DefaultValue>

<Values>

<Value>11</Value>

<Value>12</Value>

<Value>15</Value>

<Value>17</Value>

</Values>

</DefaultValue>

<Prompt>SystemBlock</Prompt>

<ValidValues>

<DataSetReference>

<DataSetName>SystemBlock</DataSetName>

<ValueField>ID</ValueField>

<LabelField>Blockname</LabelField>

</DataSetReference>

</ValidValues>

<MultiValue>true</MultiValue>

</ReportParameter>

The linked dataset:

Page 30: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 30

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

<DataSet Name="SystemBlock">

<Query>

<DataSourceName>InfoServer</DataSourceName>

<QueryParameters>

<QueryParameter Name="@LanguageID">

<Value>=Parameters!LanguageID.Value</Value>

</QueryParameter>

<QueryParameter Name="@DataSource">

<Value>=Parameters!DataSource.Value</Value>

<rd:UserDefined>true</rd:UserDefined>

</QueryParameter>

<QueryParameter Name="@ProjectGuid">

<Value>=Parameters!ProjectGuid.Value</Value>

</QueryParameter>

</QueryParameters>

<CommandText>

DECLARE @query varchar(4000)

SET @query = 'IF ((Select COUNT(ID) from [IS].[udf_TextBlock](' +

CAST( +

@LanguageID AS nvarchar(5)) + ','''+ @ProjectGuid +''')) &gt; 0)

begin

Select distinct ID, Text as Blockname from [IS].[udf_TextBlock](' +

CAST( +

@LanguageID AS nvarchar(5)) + ','''+ @ProjectGuid +''') where ID in

(11,12,13,14,15,16,17,18,19,110,111,112,113,114,115,116,117,118,119,

120) order by id

end else begin

Select distinct ID, Text as Blockname from

[IS].[udf_TextBlock](1033,'''+

@ProjectGuid +''') where ID in

(11,12,13,14,15,16,17,18,19,110,111,112,113,114,115,116,117,118,119,

120) order by id

end'

execute (@query)

</CommandText>

</Query>

<Fields>

<Field Name="Blockname">

<DataField>Blockname</DataField>

<rd:TypeName>System.String</rd:TypeName>

</Field>

<Field Name="ID">

<DataField>ID</DataField>

<rd:TypeName>System.Int32</rd:TypeName>

</Field>

</Fields>

</DataSet>

Page 31: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 31

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

“UserTextBlock” parameter

The "UserTextBlock" parameter is used to display a selection of user text blocks that can be used in message queries.

<ReportParameter Name="UserTextBlock">

<DataType>String</DataType>

<DefaultValue>

<Values>

<Value>0</Value>

</Values>

</DefaultValue>

<AllowBlank>true</AllowBlank>

<Prompt>UserTextBlock</Prompt>

<ValidValues>

<DataSetReference>

<DataSetName>UserTextBlock</DataSetName>

<ValueField>ID</ValueField>

<LabelField>Blockname</LabelField>

</DataSetReference>

</ValidValues>

<MultiValue>true</MultiValue>

</ReportParameter>

The linked dataset:

<DataSet Name="UserTextBlock">

<Query>

<DataSourceName>InfoServer</DataSourceName>

<QueryParameters>

<QueryParameter Name="@ProjectGuid">

<Value>=Parameters!ProjectGuid.Value</Value>

<rd:UserDefined>true</rd:UserDefined>

</QueryParameter>

<QueryParameter Name="@DataSource">

<Value>=Parameters!DataSource.Value</Value>

<rd:UserDefined>true</rd:UserDefined>

</QueryParameter>

<QueryParameter Name="@LanguageID">

<Value>=Parameters!LanguageID.Value</Value>

</QueryParameter>

</QueryParameters>

<CommandText>

DECLARE @query varchar(4000)

SET @query = 'IF ((Select COUNT(ID) from [IS].[udf_TextBlock](' +

CAST( +

@LanguageID AS nvarchar(5)) + ','''+ @ProjectGuid +''' )) &gt; 0)

begin

Page 32: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 32

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Select ID, Text as Blockname from [IS].[udf_TextBlock](' + CAST( +

@LanguageID AS nvarchar(5)) + ','''+ @ProjectGUID +''') where ID in

(21,22,23,24,25,26,27,28,29,210)

union Select 0 as ID, '''' as Blockname end

else begin

Select ID, Text as Blockname from [IS].[udf_TextBlock](1033,'''+

@ProjectGUID +''') where ID in (21,22,23,24,25,26,27,28,29,210)

union Select 0 as ID, '''' as Blockname end'

</Query>

<Fields>

<Field Name="ID">

execute (@query)

</CommandText>

<DataField>ID</DataField>

<rd:TypeName>System.Int32</rd:TypeName>

</Field>

<Field Name="Blockname">

<DataField>Blockname</DataField>

<rd:TypeName>System.String</rd:TypeName>

</Field>

</Fields>

</DataSet>

“ProcessValueBlock” parameter

The "ProcessValueBlock" parameter is used to display a selection of process value blocks that can be used in message queries.

<ReportParameter Name=" ProcessValueBlock ">

<DataType>String</DataType>

<DefaultValue>

<Values>

<Value>0</Value>

</Values>

</DefaultValue>

<AllowBlank>true</AllowBlank>

<Prompt>ProcessValueBlock</Prompt>

<ValidValues>

<DataSetReference>

<DataSetName>ProcessValueBlock</DataSetName>

<ValueField>ID</ValueField>

<LabelField>Blockname</LabelField>

</DataSetReference>

</ValidValues>

Page 33: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 33

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

<MultiValue>true</MultiValue>

</ReportParameter>

The linked dataset:

<DataSet Name="ProcessValueBlock">

<Query>

<DataSourceName>InfoServer</DataSourceName>

<QueryParameters>

<QueryParameter Name="@LanguageID">

<Value>=Parameters!LanguageID.Value</Value>

</QueryParameter>

<QueryParameter Name="@DataSource">

<Value>=Parameters!DataSource.Value</Value>

<rd:UserDefined>true</rd:UserDefined>

</QueryParameter>

<QueryParameter Name="@ProjectGuid">

<Value>=Parameters!ProjectGuid.Value</Value>

<rd:UserDefined>true</rd:UserDefined>

</QueryParameter>

</QueryParameters>

<CommandText>

DECLARE @query varchar(4000)

SET @query = 'IF ((Select COUNT(ID) from [IS].[udf_TextBlock](' +

CAST( +

@LanguageID AS nvarchar(5)) + ','''+ @ProjectGuid +''')) &gt; 0)

begin

Select ID, Text as Blockname from [IS].[udf_TextBlock](' + CAST( +

@LanguageID AS nvarchar(5)) + ','''+ @ProjectGUID +''') where ID in

(31,32,33,34,35,36,37,38,39,310)

union Select 0 as ID, '''' as Blockname end

else begin

Select ID, Text as Blockname from [IS].[udf_TextBlock](1033,'''+

@ProjectGUID +''') where ID in (31,32,33,34,35,36,37,38,39,310)

union Select 0 as ID, '''' as Blockname end'

</Query>

<Fields>

<Field Name="ID">

execute (@query)

</CommandText>

<DataField>ID</DataField>

<rd:TypeName>System.Int32</rd:TypeName>

</Field>

<Field Name="Blockname">

Page 34: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 34

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

<DataField>Blockname</DataField>

<rd:TypeName>System.String</rd:TypeName>

</Field>

</Fields>

</DataSet>

4.3 Tool for report creation

Report Builder

Report Builder is an MS tool that can be used to create and edit report templates in RDL format. Report Builder 3.0 is offered for download on the MS Support pages. Report Builder provides a set of report parts, such as "Tables" and "Charts", which can be used for creation of report templates.

With the installation of Report Builder, you also receive detailed help.

Note Download Report Builder:

http://www.microsoft.com/downloads/de-de/details.aspx?FamilyID=d3173a87-7c0d-40cc-a408-3d1a43ae4e33

4.4 Installation of Report Builder using the Report Manager

Report Builder can also be installed using the Report Manager of the Information Server.

Installing Report Builder

To install Report Builder, follow these steps:

1. Start the "Reporting Services Configuration Manager" using the menu command "Start > Configuration Tools > Reporting Services Configuration Manager".

The Reporting Services Configuration Manager opens.

2. Click on the configured URL address.

Page 35: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 35

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

The Report Manager opens.

3. Click the "Report Builder" button to start the installation of Report Builder.

4. Click the "Run" button to confirm the installation of Report Builder.

5. Enter the appropriate installation path. The installation path depends on the corresponding instance.

Page 36: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 36

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Information Server installation, example path 1:

C:\Program Files\Microsoft SQL Server\MSRS10_50.INFSERVER\Reporting Services\ReportServer\ReportBuilder\ReportBuilder_3_0_0_0.application

Information Server and Process Historian installation, example path 2: C:\Program Files\Microsoft SQL Server\MSRS10_50.HISTORIAN\Reporting Services\ReportServer\ReportBuilder\ReportBuilder_3_0_0_0.application

4.4.1 Report Builder user interface

In this section, you will find basic information about Report Builder. A detailed description of the functions of Report Builder is available in the product help.

The following figure shows the operating areas of Report Builder:

Figure 4-2: Operating area of Report Builder

The user interface of Report Builder is made up of the following areas:

Report Data: All data that can be used in a report template can be found here.

Report Properties: The properties of the report template, such as the background color, can be found here.

Report Parts: Report Parts are objects, such as tables or text fields that can be used for displaying data in the report template.

Grouping: You can group data into columns and rows using the row and column group functionality.

Report Test: After you have designed a report template, you can test it with the help of Report Builder.

Page 37: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 37

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Note The created report can be tested using Report Builder. The tag browsing functionality of the supplied standard templates has been implemented using an external function that is known to Report Builder but can only be used in conjunction with an Internet-capable browser.

Therefore, the SIEMENS standard templates cannot be fully tested in the Report Builder environment.

After you have designed a report template, you can test it with the help of the "Run" function in the Report Builder environment.

Figure 4-3: Test of a report template

4.4.2 Connecting Report Builder to the Report Server

To test a report template in Report Builder, a connection must be established between Report Builder and the Report Server. For this purpose, you must determine the URL of Report Builder, e.g. with the help of the Reporting Services Configuration Manager.

1. Start the Reporting Services Configuration Manager with "Start > Microsoft SQL Server 2014 SP1 > Configuration Tools > Reporting Services Configuration Manager". You will find the manager in the "Web Service URL" menu.

Figure 4-4: Determining the URL of the Report Server

Page 38: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 38

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

2. Enter the determined URL in the Report Builder options in the "Settings" menu.

Figure 4-5: Report Server settings in Report Builder

When Report Builder is connected to the Report Server, this is visualized with the following icon in Report Builder.

Figure 4-6: Connected Report Server

4.4.3 Editing a report template

The report templates are .rdl files (rdl = report description language). It is possible to edit .rdl files with MS Report Builder, for example. The .rdl files are exported to a working directory with the help of the IS web application. After modification, the .rdl files can be imported back to the IS. The modified reports are then ready for use in the IS. This makes it possible to create customized report templates.

Page 39: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 39

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

4.4.4 Testing standard report templates with Report Builder

To test standard report templates with Report Builder, follow these steps:

1. Start Report Builder.

2. Open the "Alg_Table_By_Timestamp" template.

Note When you change the template, you are changing the PCS 7 standard.

3. Start the report template in Report Builder by clicking the "Start" button of Report Builder.

4. Specify the values of parameters "Project", "TimeBegin", "TimeEnd" and

"User text block".

TimeBegin = Start time of database query

TimeEnd = End time of database query

User text block = definition of which text blocks of the message will be returned by the database query

Page 40: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 40

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

5. Click the "View Report" button.

The report is displayed in Report Builder.

4.4.5 Exporting a report template and changing the name

Exporting a report template

Report templates are stored in the Information Server database. To edit them using Report Builder, the report templates must be imported to the main memory of the local computer.

Procedure

1. Connect to the Information Server with an Internet-capable browser.

2. Select the template that you want to edit.

3. Click the "Download" button.

4. Click the green arrow for the download.

5. The "File Download" dialog is displayed. Click the "Open" button.

6. The "Connect to Report Server" dialog is displayed. Click the "Connect" button.

Page 41: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 41

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Result

You have opened the report template in Report Builder and have connected to the Report Server with Report Builder.

Changing the name of the report template

When you export a report template from the Information Server, change it, and then import it back to the IS, the report template has the same name on the Runtime interface of the Information Server.

Because this can cause confusion, you should change the name of the template.

Procedure

1. Expand the "Parameters" folder.

2. Open the properties of the "Localization" parameter.

3. Open the "Default Values" menu.

4. Open the expression with the "fx" button.

5. In the "Expression" dialog of the first value, change the string: "Name_" +

Code.GetString("Alg_Table_by_Timestamp_LocalName",User!Language) In

= "Name_" + Code.GetString("MyMessages",User!Language)

(under the assumption that VB function GetString contains your localization function that receives a resource key and the language of the user.)

6. Save the report template to the local hard drive under the name "MyMessages".

7. Click the "Upload" button in the IS client.

8. Use the browser button to select the .rdl file "MyMessages.rdl".

9. Click "Upload".

Result

You have imported a report template named "MyMessages" to the IS.

Page 42: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 42

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

4.4.6 Calculations

You can configure many calculations with the help of Report Builder. If a text field is placed in an existing report template and the expression dialog is opened, for example, a variety of functions can be selected.

Procedure

1. Connect to the Information Server using an Internet-capable browser.

2. In the Tags folder in the "Reporting" menu, select the report template

3. "Trend".

4. Click the "Download" button.

5. Click the green arrow for the download.

6. Click "Save" in the "File Download" dialog.

7. Save the template to your hard drive under the name

8. "MyTrend.rdl".

9. Click "Open" in the "Download Complete" dialog. The report template is opened in Report Builder.

10. Click "Connect" in the "Connect to Report Server" dialog.

11. Open the "Insert" menu in Report Builder.

12. Insert a text box in the report template.

13. Select the text box and open the shortcut menu with a right-click.

14. Select the menu command "Expression".

15. Select "Category = Dataset" and "Item = DataSet1", and double-click "Value = Sum (ValueFloat)".

16. Click "OK".

17. Save the change and import the report template to the IS.

18. Test the modified report template.

Result

The modified trend template contains a text box that calculates and displays the sum of all "ValueFloat" values of "Dataset1".

Page 43: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 43

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

4.4.7 Direct SQL statements in Report Builder

Database programming expertise is needed for the creation of customized SQL queries. A description of the basics of database programming is not within the scope of this document. For this reason, database programming is presented here using an example in which not all terms are fully explained.

You can program database queries to the Process Historian database named

"HistorianStorage" in Report Builder. The database query of a report template is issued via the Information Server, however. The Information Server is connected to the Process Historian database via a linked server. This must be taken into account in the syntax of the SQL query.

It is recommended that these SQL queries be programmed against a DB view.

Basic procedure

1. If you have an Information Server without PH installation: Connect to the Information Server SQL Server instance named "INFSERVER" with the SQL Server Management Studio. If you are using a combined PH/IS installation: Connect to the Process Historian SQL Server instance named "HISTORIAN" with the SQL Server Management Studio.

2. Navigate to the linked server and then to the Process Historian database "HistorianStorage".

3. Design your customized SQL query.

4. Copy the SQL query and implement it in the report template using Report Builder.

SQL query example

The following example shows a database query to the current 1000 entries of the "HistorianStorage" database using database view "VTagValue".

SELECT Top 1000 [TagUID]

,[TimeStamp]

,[DataGroupID]

,[SourceNodeID]

,[InternalFlags]

,[Flags]

,[Quality]

,[ValueFloat]

FROM [LS_Master_Test_PH_MP].[HistorianStorage].[TLG].[VTagValue]

Page 44: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 44

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

4.5 Date and time

Time stamps are stored in the database in UTC format. The local time of the calling application must be converted to UTC.

Figure 4-7: Principle of conversion of local time to UTC format

The clock times entered during runtime are converted in the query parameters of the dataset:

Example:

<QueryParameter Name="@TimeBegin">

<Value>=Parameters!TimeBegin.Value.ToUniversalTime()</Value>

</QueryParameter>

The views of the PH database are designed in such a way that they supply UTC times analogous to WinCC. You can find more detailed information on the time stamp conversion in section 3.5.2.

A VB.Net V1.1 method "ToUniversalTime" is available for the conversion.

Note You can find more detailed information about this method in the VB.Net documentation on the Internet.

Page 45: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 45

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

4.5.1 Examples of time functions

In this section, you will find a description of the time functions that are used in the report templates of the Process Historian.

Now

Returns a value that contains the current date and time of the system.

= Now()

DateAdd

A specified number of time intervals can be added to an input value. This function returns this calculated datetime value.

Syntax:

DateAdd( _

ByVal Interval As DateInterval, _ ByVal Number As Double, _

ByVal DateValue As DateTime _

)

Arguments:

Interval

Required. Value from the DateInterval enumeration or String expression that represents the time interval to be added.

Number

Required. Value of the type Double. Floating-point expression that represents the number of intervals to be added. Number can be positive (for a time in the future) or negative (for a time in the past). Any fraction of Number is ignored.

DateValue

Required. Date. An expression that specifies the date and time to which the interval is to be added. DateValue itself is not changed in the calling program.

Example:

= DateAdd("n",-2,Now())

ToUniversalTime

Example of how a current time value is converted to UTC time format in Report Builder.

= Parameters!TimeBegin.Value.ToUniversalTime()

ToLocalTime

Example of a typical use in the Information Server

<Value>=TimeZone.CurrentTimeZone.ToLocalTime(Code.ToDateTime(Fields!

Times tamp.Value))</Value>

Units and abbreviations

The following table lists the date units and abbreviations that are recognized by the expression evaluation. "datepart" names are not case-sensitive.

Page 46: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 46

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Table 4-1: Units and abbreviations for time functions

Date unit Abbreviations

Year yy, yyyy Quarter qq, q Month mm, m Dayofyear dy, y Day dd, d week wk, ww Weekday dw, w Hour Hh Minute mi, n Second ss, s Millisecond Ms

4.5.2 Conversion of time stamps to local time

This example shows how the UTC time values of the dataset are converted to local time in Report Builder. The "Trend" template of the Information Server is used as an example.

Example:

=TimeZone.CurrentTimeZone.ToLocalTime(Fields!Timestamp.Value)

The following figure shows where the time conversion is configured in the report template.

Figure 4-8: Conversion of the time stamps of the trend template

TimeBegin default stamp calculation

This example shows how the default start time of parameter

"@TimeBegin" in the report template is determined. The default start time is determined in local time. The "Trend" template of the Information Server is used as an example.

Example:

= DateAdd(“n”,-2,Now())

Page 47: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

4 The report templates of the Information Server

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 47

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

The following figure shows where the time conversion is configured in the report template.

Figure 4-9: TimeBegin parameter

Conversion of time stamps in the dataset of the report template

The start time "@TimeBegin", which is passed as a parameter in the local time, must be converted back to UTC time for the DB query.

Example:

= Parameters!TimeBegin.Value.ToUniversalTime()

The following figure shows where the time conversion is configured in the report template.

Figure 4-10: Conversion of time stamps to UTC

Page 48: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

5 Working with the database

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 48

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

5 Working with the database The database contains data of OS servers, OS single stations and SIMATIC BATCH servers. A description of the SIMATIC BATCH database structure is not within the scope of this documentation. Archive tags and OS messages with long-term relevance are stored in the PH database. The following section uses an example to describe which database views are needed for an OS report with archived OS tags and OS messages.

We generally recommend using database views instead of database tables for reporting because the data structure of tables can change over the course of further development stages. It is, however, ensured that the database views remain unchanged. As a result, report templates are functional even after a software upgrade.

To avoid having to adapt your self-created report templates following database changes, we also recommend that you explicitly query all database columns and not work with "SELECT*".

Finally, it is recommended that datasets be created with the stored procedures of the IS, because these have already been tested and can achieve better performance.

5.1 OS archive tags

OS archive tags with long-term relevance are stored in the PH database. For this purpose, a tag browsing view named "IS.VTagBrowsing" is available for each OS server.

The tag names are assigned to a unique "TagUID" key in this view. Tag values can only be identified using the "TagUID" key in the "TLG.VTagValue" view.

If the tag values are to be assigned to the tag name, you must connect the two views using a "Join".

5.1.1 IS.VTagBrowsing

All TagNames are assigned to the unique "TagUID" keys in the IS.VTagBrowsing view.

Figure 5-1: IS.VTagBrowsing view

5.1.2 TLG.VTagValue

Tag values can be read with the "TLG.VTagValue" view. This requires that the "TagUID" key be known.

Figure 5-2: "TLG.VTagValue" view

Page 49: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

5 Working with the database

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 49

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

5.1.3 Designing SQL queries at the database level

The use of the SQL Server Management Studio is one approach for development of SQL queries. Another approach is the use of a graphic Query Designer, which is a component of the SQL Server MMS.

Example:

In the figure, a Join of the VTagBrowsing view with the VTagValue view is designed. The connecting table field is the TagUID key.

Figure 5-3: Query Designer

For performance reasons, the database queries for the Process Historian were designed as stored procedures. The user can use all stored procedures that belong to the IS database schema.

We recommend using these tested stored procedures.

Note Because the "Table-valued function" "IS.udf_GetTagValues" is omitted in version V8.0 SP1, we recommend use of the stored procedure "IS.udsp_getTagTable" or "IS.udsp_getTagTableWithoutName" instead for reading PH tags.

Note To learn how to create database queries using the SQL Server Management Studio, refer to the appropriate Microsoft documentation.

Page 50: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

5 Working with the database

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 50

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

5.2 Working with stored procedures of the Information Server database schema

The stored procedures of the IS database schema are the user interface of the Process Historian. These stored procedures can be used to read data of the Information Server from the Process Historian. The stored procedures are described in the section "Technical specifications".

At this point, examples will be used to illustrate how you can call the stored procedures, and the result of the call will be shown.

5.2.1 Example "udsp_getTagTable"

The SQL call of the SP in the SQL Server MMS is described below. Detailed information is available in the section "Basic PH functions".

USE [HistorianStorage] GO

/****** Object: StoredProcedure [IS].[udsp_getTagTable] Script Date:

06/03/2012 17:20:40 ******/

SET ANSI_NULLS ON GO

SET QUOTED_IDENTIFIER OFF GO

create procedure [IS].[udsp_getTagTable] (

@tagIds nvarchar(max),

@TimeBegin datetime2,

@TimeEnd datetime2

)

as

Select TagName, Convert(datetime2,TimeStamp,1) as Timestamp,

ValueFloat,Quality, Flags from [TLG].[VTagValue] as TV

inner join [IS].[VTagBrowsing] on TV.TagUID =

[VTagBrowsing].[TagUID]

where (TimeStamp > @TimeBegin AND TimeStamp < @TimeEnd) AND

TV.[TagUID] IN (@tagIds)

GO

Examples for TagUID, Tag Name, Time Stamp

You can obtain the TagUID for a TagName from the VTagBrowsing view.

TagUID: 2E7C5D5B-8FBD-4F7C-A30C-9A4ABAAF9040

TagName: Trend/Simul/MEAS.U

TimeStamp 2012-03-19 01:00:00.2780000 +01:00

Page 51: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

5 Working with the database

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 51

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Example of call with SQL Server MMS

The following example shows the basic procedure for calling the SP in the SQL Server MMS.

USE [HistorianStorage] GO

DECLARE @return_value int

EXEC @return_value = [IS].[udsp_getTagTable]

@tagIds = N'8DA4A5D2-5392-4262-A2DA-77E8ED2F81C3',

@TimeBegin = '2012-05-07 02:00:00',

@TimeEnd = '2012-05-07 03:00:00'

SELECT 'Return Value' = @return_value

GO

Figure 5-4: Table view

5.2.2 Example "udsp_getTagTrend"

Example with SQL Server MMS

The SQL call of the SP in the SQL Server MMS is described below. You can find detailed information in the section "Basic PH functions".

USE [HistorianStorage] GO

DECLARE @return_value int

EXEC @return_value = [IS].[udsp_getTagTrend]

@tagIds = N'8DA4A5D2-5392-4262-A2DA-77E8ED2F81C3',

@TimeBegin = '2012-05-07 02:00:00',

@TimeEnd = '2012-05-07 03:00:00',

@Pixel = 5

SELECT 'Return Value' = @return_value GO

Figure 5-5: Table view

Page 52: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

5 Working with the database

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 52

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

5.2.3 Example "udsp_getTagAggregetion"

Example with SQL Server MMS

In this example, the maximum value of an archive tag is calculated using @Timestep = 600.

@Timestep specifies the calculation interval in seconds. The interval between @TimeBegin and @TimeEnd is 3600 seconds, and the result is therefore a table with six rows.

USE [HistorianStorage] GO

DECLARE @return_value int

EXEC @return_value = [IS].[udsp_getTagAggregation]

@tagIds = N'8DA4A5D2-5392-4262-A2DA-77E8ED2F81C3',

@TimeBegin = '2012-05-07 02:00:00',

@TimeEnd = '2012-05-07 03:00:00',

@Aggregation = N'Max',

@Timestep = 600

SELECT 'Return Value' = @return_value GO

Note N’ means that the string is specified in UNICODE.

Figure 5-6: Table view

Note Report parameters such as "@Project" or "@Catalog" cannot be used in SQL queries. For this reason, database queries are executed as a string in the standard report templates. The report parameters can be used in SQL queries in this way.

Page 53: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

5 Working with the database

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 53

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Example: Executing an SQL query as a string

This example SQL query shows how you can execute a query as a string.

declare @stmt nvarchar(4000) declare @Project nvarchar(36) declare

@TagID nvarchar(36) declare @TimeStart nvarchar(36) declare @TimeEnd

nvarchar(36) declare @Agregation nvarchar(36) declare @Samples

nvarchar(36) set @Project = 'DB_PE_MP_71_Prj'

set @TagID = '8DA4A5D2-5392-4262-A2DA-77E8ED2F81C3'

set @TimeStart = '2012-05-07 02:00:00'

set @TimeEnd = '2012-05-07 03:00:00'

set @Agregation = 'Max' set @Samples = '600'

set @stmt = '

exec [' + @Project + '].[IS].[udsp_getTagAggregation]

'''+@TagID+''',

'''+@TimeStart+''',

'''+@TimeEnd+''',

'''+@Agregation+''', '+@Samples+'

'

exec (@stmt)

Example: Hard-coded creation of a dataset in Report Builder using SP

udsp_getTagAggregation

The following example shows how you can specify the TagUID, start time and end time of the query in Report Builder in a hard-coded manner in order to create a dataset.

exec [DB_PE_MP_71_Prj].[IS].[udsp_getTagAggregation] '8DA4A5D2-5392-

4262-A2DA-77E8ED2F81C3',

'2012-05-07 02:00:00',

'2012-05-07 03:00:00',

'Max', 600

Figure 5-7: "Dataset Properties" dialog

Page 54: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

5 Working with the database

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 54

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Test in Report Builder

In the figure below, you see the representation of the dataset in Report Builder during runtime.

Figure 5-8: "Report Builder" dialog

Note Editing a dataset with a stored procedure and hard-coded transfer values is easiest from the programming perspective but offers the least flexibility.

5.2.4 Example "udsp_GetMessagesPerDay"

The SQL call of the SP in the SQL Server MMS is described below. You can find detailed information in the section "Basic PH functions".

USE [HistorianStorage] GO

DECLARE @return_value int

EXEC @return_value = [IS].[udsp_getMessagesPerDay]

@projectUID = '40c15ada-df7f-49bc-968b-b3779ea46150' ,

@lcid = 1031,

@timeBegin = N'2012-04-17 18:00:00',

@timeEnd = N'2012-04-20 20:00:00',

@MsgClasses = '1,2,3,4,5,6,7,8,9,10,16,17,18'

SELECT 'Return Value' = @return_value GO

Figure 5-9: Table view

Page 55: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

5 Working with the database

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 55

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

5.2.5 Example "udsp_getMessagesPer10Minutes"

The SQL call of the SP in the SQL Server MMS is described below. You can find detailed information in the section "Basic PH functions".

Example: Call in SQL Server MMS

The following example shows how you can call the SP in the SQL Server MMS.

USE [HistorianStorage] GO

DECLARE @return_value int

EXEC @return_value = [IS].[udsp_getMessagesPer10Minutes]

@projectUID = '40c15ada-df7f-49bc-968b-b3779ea46150',

@timeBegin = N'2012-04-17 18:00:00',

@timeEnd = N'2012-04-17 20:00:00'

SELECT 'Return Value' = @return_value GO

Figure 5-10: Table view

5.2.6 Example "udsp_ getQuantityByMessageClass"

The SQL call of the SP in the SQL Server MMS is described below. You can find detailed information in the section "Basic PH functions".

Example of call in SQL Server MMS

The following example shows how you can call the SP in the SQL Server MMS.

USE [HistorianStorage] GO

DECLARE @return_value int

EXEC @return_value = [IS].[udsp_getQuantityByMessageClass]

@projectUID = '40c15ada-df7f-49bc-968b-b3779ea46150',

@LCID = 1031,

@timeBegin = N'2012-04-17 18:00:00',

@timeEnd = N'2012-04-18 18:00:00'

SELECT 'Return Value' = @return_value GO

Figure 5-11: Table view

Page 56: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

5 Working with the database

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 56

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

5.2.7 Example "udsp_ getQuantityByMessageClass"

The SQL call of the SP in the SQL Server MMS is described below. You can find detailed information in the section "Basic PH functions".

Example of call in SQL Server MMS

The following example shows how you can call the SP in the SQL Server MMS, in principle.

USE [HistorianStorage] GO

DECLARE @return_value int

EXEC @return_value = [IS].[udsp_getQuantityByMessageClass]

@projectUID = '40c15ada-df7f-49bc-968b-b3779ea46150',

@LCID = 1031,

@timeBegin = N'2012-04-17 18:00:00',

@timeEnd = N'2012-04-18 18:00:00'

SELECT 'Return Value' = @return_value GO

Figure 5-12: Table view

Page 57: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

6 Glossary

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 57

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

6 Glossary The following table presents the abbreviations used in the document:

Abbreviation Meaning

Alg Alarm logging

BL Business Logic (Database Views and Stored Procedures)

CS Configuration

DB Database

EEMUA Engineering Equipment and Materials Users’ Association

GUID Globally Unique Identifier

IIS Internet Information Server

IS Information Server

MMS Management Studio

MS Microsoft

OS Operator Station

PH Process Historian

RB Report Builder

RDL Report Description Language

RT Runtime

SP Stored Procedure

Tlg Tag logging

URL Uniform Resource Locator

Page 58: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

7 Appendix

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 58

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

7 Appendix

7.1 Service and Support

Industry Online Support

Do you have any questions or need assistance?

Siemens Industry Online Support offers round the clock access to our entire service and support know-how and portfolio.

The Industry Online Support is the central address for information about our products, solutions and services.

Product information, manuals, downloads, FAQs, application examples and videos – all information is accessible with just a few mouse clicks at: https://support.industry.siemens.com/

Technical Support

The Technical Support of Siemens Industry provides you fast and competent support regarding all technical queries with numerous tailor-made offers – ranging from basic support to individual support contracts. You send queries to Technical Support via Web form: www.siemens.com/industry/supportrequest.

Service offer

Our range of services includes, inter alia, the following:

Product trainings

Plant data services

Spare parts services

Repair services

On-site and maintenance services

Retrofitting and modernization services

Service programs and contracts

You can find detailed information on our range of services in the service catalog: https://support.industry.siemens.com/cs/sc

Industry Online Support app

You will receive optimum support wherever you are with the "Siemens Industry Online Support" app. The app is available for Apple iOS, Android and Windows Phone: https://support.industry.siemens.com/cs/ww/en/sc/2067

Page 59: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

7 Appendix

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 59

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

7.2 Links and Literature

Table 7-1

No. Topic

\1\ Siemens Industry Online Support

https://support.industry.siemens.com

\2\ https://support.industry.siemens.com/cs/ww/de/view/64906050

\3\ Process Historian and Information Server in a PCS 7 environment

https://support.industry.siemens.com/cs/ww/en/view/66579062

7.3 Change documentation

Tabelle 7-2

Version Date Change

V1.0 11/2012 First version

V2.0 12/2016 Updated for new versions (PCS 7, PH, IS)

V2.1 03/2018 Addition new functions

7.4 Appendix: Technical specifications

In the appendix, you will find the technical documentation of the standard stored procedures of the Information Server and a description of how you create your own business logic in the PH database.

This description is specifically for developers that create customer-specific report templates. The texts are in English only.

Page 60: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 60

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

A Information Server Stored Procedures At least one proxy database called “ISProxy_n” is generated for each project that has been configured for use with Information Server, where “n” represents the internal data source ID associated with the project. The proxy databases reside in the same SQL Server instance the “Webframe” database is in. In the case of data sources that have been configured for redundancy, an additional proxy database called “ISProxy_n_Redundant” is generated.

These databases contain proxy stored procedures that call corresponding stored procedures that reside in the actual data sources. In the case of the data sources being remote SQL Server instances, the stored procedures are ultimately executed through SQL Server linked server objects.

The stored procedures and user-defined functions return configuration data and runtime data for data sets in SQL Server Reporting Services reports.

A.1 Common Parameters

A.1.1 @lcid

The Windows locale ID used to localize certain strings returned for both configuration data and runtime data queries. Only pre-defined values that the data source was configured for may be used. No fallbacks are supported.

Table A-1: Common Locale IDs

LCID Language

1031 German

1033 English (US)

1036 French

1040 Italian

3082 Spanish (Modern)

2052 Chinese (Simplified)

1028 Chinese (Traditional)

1042 Korean

1041 Japanese

1034 Spanish (Traditional)

See also:

https://msdn.microsoft.com/en-us/goglobal/bb964664.aspx

A.1.2 @projectGuid

A GUID that identifies an individual project within a data source configured for use with Information Server. This is necessary because Process Historian databases may hold configuration data and runtime data for any number of projects.

In the case of Process Historian data sources, this GUID corresponds to the organizational structure GUID of the WinCC project or the PCS 7 project.

In the case of WinCC data sources, the GUID is unused and is generally set to all zeroes.

Page 61: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 61

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

A.2 General Functions

[IS].[udf_getDatasourceNodes]

Retrieves the data source nodes (OS) associated with a project.

Table A-2: udf_getDatasourceNodes Arguments

Parameter Name Data Type Description

@projectUID uniqueidentifier Project ID

Table A-3: udf_getDatasourceNodes Return Values

Field Data Type Description

DatasourceNodeUID uniqueidentifier Data source node ID

A.3 Alarm Logging

A.3.1 [IS].[udf_TextBlock]

Returns information about text blocks configured for the WinCC project.

Table A-4: System blocks

ID Name

11 Date

12 Time

13 Message Duration

14 Daylight Saving/Standard Time

15 Status

16 Acknowledged

17 Number

18 Class

19 Type

110 Controller/CPU Number

111 Tag

112 Limit Violation

113 Archiving ID

114 Report ID

115 Comment

116 Info

117 Loop in Alarm

118 Computer Name

119 User Name

120 Priority

Page 62: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 62

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Table A-5: Text blocks

ID Name

21 Source

22 Area

23 Event

24 Batch name

25 Operation

26 Text block 6

27 Text block 7

28 Text block 8

29 Text block 9

210 Text block 10

Table A-6: Process Value Blocks

ID Name

31 Process value 1

32 Process value 2

33 Process value 3

34 Process value 4

35 Process value 5

36 Process value 6

37 Process value 7

38 Process value 8

39 Process value 9

310 Process value 10

Table A-7: udf_TextBlock Return Values

Field Data Type Description

ID int Text block ID

LCID int Language ID

Text nvarchar(max) Block name

OrganizationalStructureUID uniqueidentifier Project ID

Page 63: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 63

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

A.3.2 [IS].[udf_ getMessageDefinitions]

Only supported by Process Historian. Returns configuration data of all messages defined for the specified project.

Table A-8: udf_getMessageDefinitions Arguments

Parameter Name Data Type Description

@projectUID uniqueidentifier ProjectID

Table A-9: udf_getMessageDefinitions Return Values

Field Data Type Description

DatasourceNodeUID uniqueidentifier Data source node ID

MessageDefinitionUID uniqueidentifier Message definition ID

MessageClassUID uniqueidentifier Message class ID

MessageTypeUID uniqueidentifier Message type ID

PARAMS int Contains multiple flags:

Archiving (4)

Logging (8)

Loop-in alarm (128)

AG_NR smallint Rack ID

CPU_NR smallint PLC ID

Priority int Priority

WinCCMessageID bigint WinCC message ID

DataSourceNode_Name nvchar(max) Name of data source node

A.3.3 [IS].[udf_getAlarmDefinitions]

Only supported by Process Historian. Returns configuration data of alarms that require acknowledgment associated with the specified project.

Table A-10: udf_getAlarmDefinitions Arguments

ParameterName DataType Description

@projectUID uniqueidentifier Project ID

Page 64: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 64

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Table A-11: udf_getAlarmDefinitions Return Values

Field Data Type Description

DatasourceNodeUID uniqueidentifier Data source node ID

MessageDefinitionUID Uniqueidentifier Message definition ID

MessageClassUID Uniqueidentifier Message class ID

MessageTypeUID Uniqueidentifier Message type ID

AG_NR int Contains multiple flags:

Archiving (4)

Logging (8)

Loop-in alarm (128)

CPU_NR smallint Rack ID

Priority smallint PLC ID

WinCCMessageID int Priority

TextNameUID bigint WinCC message ID

WinCCClassID Uniqueidentifier ID of text resource of message class

PARAMS int WinCC class ID

Table A-12: PCS 7 Acknowledgeable Message Classes

Message Class ID Message Class Name

1 Alarm

2 Warning

3 Tolerance

4 PLC process control message

5 OS process control system messages

6 Preventive maintenance

7 Process message

17 System, must be acknowledged

Page 65: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 65

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

A.3.4 [IS].[udsp_ getAcknowledgeableMessageClasses]

Returns the IDs and names of all message classes of a project that require acknowledgment.

Table A-13: udsp_getAcknowledgeableMessageClasses Arguments

Parameter Name Data Type Description

@projectUID Uniqueidentifier Project ID

@LCID int Language ID

Table A-14: udsp_getAcknowledgeableMessageClasses Return Values

Field Data Type Description

MessageClassID int WinCC message class ID

MessageClassName nvarchar(max) Message class name

Table A-15: PCS 7 Acknowledgeable Message Classes

Message Class ID Message Class Name

1 Alarm

2 Warning

3 Tolerance

4 PLC process control message

5 OS process control system messages

6 Preventive maintenance

7 Process message

17 System, must be acknowledged

A.3.5 [IS].[udsp_ getMessageClasses]

Returns the IDs and names of all message classes of a project.

Table A-16: udsp_getMessageClasses Arguments

Parameter Name Data Type Description

@projectUID uniqueidentifier Project ID

@LCID int Language ID

Table A-17: udsp_getMessageClasses Return Values

Field Data Type Description

MessageClassID int WinCC message class ID

MessageClassName nvarchar(max) Message class name

Page 66: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 66

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Table A-18: PCS 7 Message Classes

Message Class ID Message Class Name

1 Alarm

2 Warning

3 Tolerance

4 PLC process control message

5 OS process control system messages

6 Preventive maintenance

7 Process message

8 Operating message

9 Request for Operator Input

10 Operator Input Message

16 Status Message

17 System, must be acknowledged

18 System, need not be acknowledged

A.3.6 [IS].[udsp_ getPercentageOfPriorityInAlarmSettings]

Returns the distribution of priorities in the alarm configuration of a project.

Table A-19: udsp_getPercentageOfPriorityInAlarmSettings Arguments

Parameter Name Data Type Description

@projectUID uniqueidentifier Project ID

Table A-20: udsp_getPercentageOfPriorityInAlarmSettings Return Values

Field Data Type Description

Type nvarchar(max) „ConfiguredAlarms“ (constant string)

Priority int Priority

RelCount float Percentage of alarms with this priority

Page 67: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 67

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

A.3.7 [IS].[udsp_ getDurationOfAckn]

Returns the distribution of acknowledgement durations within the specified time span.

Table A-21: udsp_getDurationOfAckn Arguments

Parameter Name Data Type Description

@projectUID Uniqueidentifier Project ID

@timeBegin datetime2 Start time

@timeEnd datetime2 End time

Table A-22: udsp_getDurationOfAckn Return Values

Field Data Type Description

TimeDiff int Duration of acknowledgement (seconds)

Count int Number of alarms with that duration of acknowledgement

A.3.8 [IS].[udsp_getMessagesPerDay]

Returns the distribution of message classes within messages that were raised within the specified time span.

Table A-23: udsp_getMessagesPerDay Arguments

Parameter Name Data Type Description

@projectUID uniqueidentifier Project ID

@lcid int Language ID

@timeBegin datetime2 Start time

@timeEnd datetime2 End time

@MsgClasses nvarchar(max) WinCC message class IDs (comma-separated string)

Table A-24: udsp_getMessagesPerDay Return Values

Field Data Type Description

Count int Number of messages

Date date The date on which the messages occurred

MessageClassName nvarchar(max) Message class name

Page 68: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 68

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

A.3.9 [IS].[udsp_ getPercentageOfPriorityInRTAlarms]

Returns the distribution of priorities of alarms that were raised within the specified time span.

Table A-25: udsp_getPercentageOfPriorityInRTAlarms Arguments

Parameter Name Data Type Description

@projectUID uniqueidentifier Project ID

@timeBegin datetime2 Start time

@timeEnd datetime2 End time

Table A-26: udsp_getPercentageOfPriorityInRTAlarms Return Values

Field Data Type Description

Type nvarchar(max) „AnnunciatedAlarms“ (constant string)

Priority int Priority

RelCount float Percentage of alarms with that priority

A.3.10 [IS].[udsp_getMessagesPer10Minutes]

Subdivides the specified time span into periods of 10 minutes and returns the number of alarms that occurred in each. According to EEMUA, more than 10 alarms in such a period constitute the beginning of an alarm flood, in which alarms are presented at a rate faster than they can be dealt with effectively by the operator. During such periods, important alarms are likely to be missed.

Table A-27: udsp_getMessagesPer10Minutes Arguments

Parameter Name Data Type Description

@projectUID uniqueidentifier Project ID

@timeBegin datetime2 Start time

@timeEnd datetime2 End time

Table A-28: udsp_getMessagesPer10Minutes Return Values

Field Data Type Description

Date datetime2 Start time of 10 minute period

Count int Number of messages that occurred in that period

Page 69: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 69

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

A.3.11 [IS].[udsp_getAlarmsByPriority]

Returns the number of alarms of a particular priority that were raised in the specified time span. In a three-priority system, such as Low, Medium, High, EEMUA recommends a distribution of 80% “Low”, 15% “Medium” and 5% “High”. Distributions at wide variance to these percentages are a concern, and generally indicate alarm settings that did not result from a consistent alarm rationalization methodology.

Table A-29: udsp_getAlarmsByPriority Arguments

Parameter Name Data Type Description

@projectUID uniqueidentifier Project ID

@timeBegin datetime2 Start time

@timeEnd datetime2 End time

Table A-30: udsp_getAlarmsByPriority Return Values

Field Data Type Description

Priority int Priority

Count int Number of alarms with that priority that occurred in the specified time span

A.3.12 [IS].[udsp_getQuantityByMessageClass]

Returns the number of alarms that were raised in the specified time span, grouped by their message class.

Table A-31: udsp_getQuantityByMessageClass Arguments

Parameter Name Data Type Description

@projectUID uniqueidentifier Project ID

@LCID int Language ID

@timeBegin datetime2 Start time

@timeEnd datetime2 End time

Table A-32: udsp_getQuantityByMessageClass Return Values

Field Data Type Description

Count int Number of messages of that particular message class that occurred in the specified time span

MessageClassName nvarchar(max) Message class name

Page 70: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 70

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

A.3.13 [IS].[udsp_ getTotalDurationUntilAcknowledgment]

Returns the sum of acknowledgment durations of alarms that were raised in the specified time span. The results are grouped by the value of an alarm attribute.

Table A-33: udsp_getTotalDurationUntilAcknowledgment Arguments

Parameter Name Data Type Description

@projectUID uniqueidentifier Project ID

@LCID int Language ID

@timeBegin datetime2 Start time

@timeEnd datetime2 End time

@groupBy nvarchar(max) Name of alarm attribute to group by

Values supported: “WinCCMessageID” “Text1”, ..., “Text10”

@Top int Maximum number of rows returned

Table A-34: udsp_getTotalDurationUntilAcknowledgment Return Values

Field Data Type Description

Duration int Sum of acknowledgment durations for this group

Attribute int or nvarchar(max) Value of attribute the durations were grouped by

A.3.14 [IS].[udsp_ getTotalDurationUntilWent]

Returns the sum of alarm clearing times (i.e. the delay between an alarm being raised and cleared) for the specified time span. The results are grouped by the value of an alarm attribute.

Table A-35: udsp_getTotalDurationUntilWent Arguments

Parameter Name Data Type Description

@projectUID uniqueidentifier Project ID

@LCID int Language ID

@timeBegin datetime2 Start time

@timeEnd datetime2 End time

@groupBy nvarchar(max) Name of alarm attribute to group by

Values supported: “WinCCMessageID” “Text1”, ..., “Text10”

@Top int Maximum number of rows to return

Page 71: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 71

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Table A-36: udsp_getTotalDurationUntilWent Return Values

Field Data Type Description

Duration int Sum of clearing times for this group

Attribute int or nvarchar(max) Value of alarm attribute the durations were grouped by

A.3.15 [IS].[udsp_getAlarmsByOrigin]

Returns the number of alarms that were raised in the specified time span. The results are grouped by the value of an alarm attribute.

Table A-37: udsp_getAlarmsByOrigin Arguments

Parameter Name Data Type Description

@projectUID uniqueidentifier Project ID

@LCID int Language ID

@timeBegin datetime2 Start time

@timeEnd datetime2 End time

@groupBy nvarchar(max) Name of alarm attribute to group by

Values supported: “Text1”, ..., “Text10”

@Top int Maximum number of rows to return

Table A-38: udsp_getAlarmsByOrigin Return Values

Field Data Type Description

Count int Number of alarms from that origin

Origin nvarchar(max) Origin

Page 72: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 72

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

A.3.16 [IS].[udsp_getMessageTable]

Returns all messages in the specified time span matching additional constraints.

Table A-39: udsp_getMessageTable Arguments

Parameter Name Data Type Description

@projectUID uniqueidentifier Project ID

@LCID int Language ID

@timeBegin datetime2 Start time

@timeEnd datetime2 End time

@ExpressionCondition nvarchar(max) Additional SQL constraints to be applied to the query (must start with “AND ...”)

@maxcount int Defines how many rows are fetched. Default value is: 20000000

@columns nvarchar(max) Defines which columns are being fetched. Default columns are: Convert(datetime2,[TimeS tamp],1) as [Timestamp]

,[MessageNumber]

,[TimeDiff]

,[DaylightSavingTime]

,[Statustext]

,[FlagText],[State]

,[MessageClassID]

,[MessageClassName]

,[MessageTypeName]

,[AG_NR] ,[CPU NR]

,[Archiving] ,[Logging]

,[LoopInAlarm]

,[ComputerName]

,[UserName] ,[Priority]

,[Infotext] ,[Comment]

,[Text1] ,[Text2] ,[Text3]

,[Text4] ,[Text5] ,[Text6]

,[Text7] ,[Text8] ,[Text9]

,[Text10] ,[PValue1]

,[PValue2] ,[PValue3]

,[PValue4] ,[PValue5]

,[PValue6] ,[PValue7]

,[PValue8] ,[PValue9]

,[PValue10]

Page 73: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 73

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Table A-40: udsp_getMessageTable Return Values

Field Data Type Description

Timestamp datetime2 Time of state change

MessageNumber nvarchar(max) WinCC alarm ID

TimeDiff int Acknowledgment duration (milliseconds)

DaylightSavingTime int Daylight saving time flag (1 if enabled, 0 if disabled)

Statustext nvarchar(max) State text (+/-/*)

FlagText nvarchar(max) Flag text

State int State

MessageClassID int Message class ID

MessageClassName int Message class name

MessageTypeName nvarchar(max) Message Type

AG_NR Smallint Rack ID

CPU NR smallint PLC ID

Archiving int Archiving flag (1 if enabled, 0 if disabled)

Logging int Logging flag (1 if enabled, 0 if disabled)

LoopInAlarm int Loop in alarm (1 if enabled, 0 if disabled)

ComputerName nvarchar(max) Name of computer the comment was set from

UserName nvarchar(max) Name of user the comment was set by

Priority int Priority

Infotext nvarchar(max) Additional information

Comment nvarchar(max) Comment

Text1 nvarchar(max) Text block 1

Text2 nvarchar(max) Text block 2

Text3 nvarchar(max) Text block 3

Text4 nvarchar(max) Text block 4

Text5 nvarchar(max) Text block 5

Text6 nvarchar(max) Text block 6

Text7 nvarchar(max) Text block 7

Text8 nvarchar(max) Text block 8

Text9 nvarchar(max) Text block 9

Text10 nvarchar(max) Text block 10

PValue1 float Process value 1

PValue2 float Process value 2

PValue3 float Process value 3

PValue4 float Process value 4

PValue5 float Process value 5

PValue6 float Process value 6

PValue7 float Process value 7

PValue8 float Process value 8

Page 74: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 74

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Field Data Type Description

PValue9 float Process value 9

PValue10 float Process value 10

A.3.17 [IS].[udsp_ getAverageDurationOfAckn]

Returns the distribution of acknowledgment durations within the specified time span. The results are grouped by the value of an alarm attribute.

Table A-41: udsp_getAverageDurationOfAckn Arguments

Parameter Name Data Type Description

@projectUID uniqueidentifier Project ID

@LCID int Language ID

@timeBegin datetime2 Start time

@timeEnd datetime2 End time

@groupBy nvarchar(max) Name of alarm attribute to group by

Values supported: “WinCCMessageID” “Text1”, ..., “Text10”

@Top int Maximum number of rows to return

Table A-42: udsp_getAverageDurationOfAckn Return Values

Field Data Type Description

Duration int Sum of acknowledgement durations of this group (seconds)

Attribute int or nvarchar(max) Value of attribute the durations were grouped by

Page 75: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 75

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

A.4 Tag Logging

A.4.1 [IS].[VTagBrowsing]

This view provides tag configuration data for all projects within the data source. In the case of Process Historian data sources, additional queries might be necessary to distinguish between the tags of different projects.

Table A-43: VTagBrowsing Columns

Field Data Type Description

TagUID bigint (WinCC) or uniqueidentifier

Tag ID (data type depends on data source)

ArchiveName nvarchar(max) Archive name

TagName nvarchar(max) Tag name

ArcTimeInt bigint Archiving cycle (milliseconds)

ArcTime nvarchar(max) Archiving cycle text (including unit)

ScanTime nvarchar(max) Scan cycle text (including unit)

CompressTime nvarchar(max) Compression cycle text (including unit)

AggregationID bigint Aggregation mode: 1 – Empty

2 – Mean value 3 – Sum

4 – Minimum value 5 – Maximum value 6 – Variance

7 – Weighted average value

SourceArchive nvarchar(max) The archive name of the tag that is being aggregated from (only set if aggregation is being used)

SourceTag nvarchar(max) The name of the tag that is being aggregated from (only set if aggregation is being used)

PhysicalDataSourceName nvarchar(max) The name of the OS the tag is from.

Redundant PhysicalDataSourceName

nvarchar(max) In case of redundant systems, the name of the other OS the tag is on. NULL in case of standalone systems.

Page 76: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 76

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

A.4.2 [IS].[udf_getTagAggregation]

Only supported by Process Historian 2014 SP3 Update 1. Returns tag runtime data that has been processed by the specified aggregate function. One row is returned for each interval.

Table A-44: udf_getTagAggregation Arguments

Parameter Name Data Type Description

@tagIds nvarchar(max) Tag IDs (comma-separated values)

@TimeBegin datetime2 Start time

@TimeEnd datetime2 End time

@Aggregation nvarchar(max) Aggregate function to be applied to samples within the individual intervals:

‘SUM’ – Sum

‘MIN’ – Minimum ‘MAX’ – Maximum

‘AVG’ – Arithmetic mean ‘COUNT’ – Number of samples

Additional aggregate functions only supported by Process Historian:

‘INT_SaH’ – Integral of sample and hold function

‘INT_Lin’ – Integral of linear interpolation function ‘WAV_SaH’ – Arithmetic mean of sample and hold function ‘WAV_Lin’ – Arithmetic mean of linear interpolation function

@Timestep int Length of individual intervals (seconds)

Table A-45: udf_getTagAggregation Return Values

Field Data Type Description

TagName nvarchar(max) Tag name

Timestamp datetime2 Start of interval

ValueFloat float Tag value

Page 77: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 77

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

A.4.3 [IS].[udf_getTagTrend]

Only supported by Process Historian 2014 SP3 Update 1. Returns tag runtime data within the specified time span. In the case of Process Historian data sources, interpolation is used to reduce the number of samples returned, depending on the desired number of samples.

Table A-46: udf_getTagTrend Arguments

Parameter Name Data Type Description

@tagIds nvarchar(max) Tag IDs (comma-separated values)

@TimeBegin datetime2 Start time

@TimeEnd datetime2 End time

@Pixel int Desired number of samples (only supported by Process Historian)

Table A-47: udf_getTagTrend Return Values

Field Data Type Description

TagName nvarchar(max) Tag name

Timestamp datetime2 Time

ValueFloat float Tag value

Page 78: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 78

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

A.4.4 [IS].[udsp_getCalculationValues]

Returns calculated values.

Table A-48: udsp_getCalculationValues arguments

Parameter Name Data Type Description

@type int Type of used aggregation function: 1: min

2: max

3: avg

5: sum

@tagId nvarchar(max) Id of the tag

@start datetime2 Start time

@end datetime2 End time

@delta int Interval in seconds

@qualityGood int Not used

@maxcount int Defines the amount of fetched rows. 0: return all rows

Table A-49: udsp_getCalculationValues Return Values

Field Data Type Description

Timestamp datetime2 Timestamp of the retrieved tag value

ValueFloat float Tag value

Quality int Quality code

Fags nvarchar(max) WinCC status flags

Page 79: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 79

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

A.4.5 [IS].[udsp_getResolutionValues]

Returns values for boundary type (inside/outside).

Table A-50: udsp_getResolutionValues arguments

Parameter Name Data Type Description

@tagId nvarchar(max) Id of the tag

@start datetime2 Start time

@end datetime2 End time

@BoundaryType int 1: inside time interval, 2: outside time interval

@qualityGood int Not used

@maxcount int Defines the amount of fetched rows. 0: return all rows

Table A-51: udsp_ getResolutionValues Return Values

Field Data Type Description

Timestamp datetime2 Timestamp of the retrieved value

ValueFloat float Tag value

Quality int Quality code

Fags nvarchar(max) WinCC status flags

A.4.6 [IS].[udsp_getSingleValueLastNext]

Returns either the previous or the next tag value to a given timestamp.

Table A-52: udsp_getSingleValueLastNext arguments

Parameter Name Data Type Description

@tagId nvarchar(max) Id of the tag

@time datetime2 Start time

@mode int 1: next value, 2: previous value

Table A-53: udsp_getSingleValueLastNext Return Values

Field Data Type Description

Timestamp datetime2 Timestamp oft he retrieved value

ValueFloat float Tag value

Quality int Quality code

Page 80: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 80

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

A.4.7 [IS].[udsp_getTagTableWithoutName]

Returns tag values with quality code and status flags.

Table A-54: udsp_getTagTableWithoutName arguments

Parameter Name Data Type Description

@tagIds nvarchar(max) Ids of the tags (comma-separated values)

@TimeBegin datetime2 Start time

@TimeEnd int End time

Table A-55: udsp_getTagTableWithoutName Return Values

Field Data Type Description

Timestamp datetime2 Timestamp of the retrieved value

ValueFloat float Tag value

Quality int Quality code

Fags nvarchar(max) WinCC status flags

A.4.8 [IS].[udsp_getTagNamesById]

Returns tag values with quality code and status flags.

Table A-56: udsp_getTagNamesById arguments

Parameter Name Data Type Description

@tagIds nvarchar(max) Ids of the tags (comma-separated values)

Table A-57: udsp_getTagNamesById arguments

Field Data Type Description

TagId Ddtetime2 ID of the tag

TagName varchar(255) Name of the tag

TagValue float Tag value

A.4.9 [IS].[udsp_getTagParameterByld]

Returns tag values with quality code and status flags.

Table A-58: udsp_getTagParameterById arguments

Parameter Name Data Type Description

@tagIds nvarchar(max) Ids of the tags (comma-separated values)

Page 81: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 81

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Table A-59: udsp_getTagParameterById arguments

Field Data Type Description

TagName varchar(255) Archive name \ name of the tag

SourceTag varchar(255) Source archive name \ source tag name

ScanTime varchar(100) Scan time

CompressTime varchar(100) Compress time

AggregationId varchar(100) Aggregation Id

A.4.10 [IS].[udsp_getTagConfiguration]

Returns configuration data of tags whose name matches the LIKE filter.

Table A-60: udsp_getTagConfiguration Arguments

Parameter Name Data Type Description

@projectUID uniqueidentifier Project ID

@tagName nvarchar(max) Tag name filter string (SQL LIKE filter, wildcard character „%“)

Table A-61: udsp_getTagConfiguration Return Values

Field Data Type Description

TagUID bigint (WinCC) or uniqueidentifier (Process Historian)

Tag ID (data type depends on data source)

TagName nvarchar(max) Tag name

ArcTime nvarchar(max) Archiving cycle text (including unit)

ScanTime nvarchar(max) Scan cycle text (including unit)

CompressTime nvarchar(max) Compression cycle text (including unit)

AggregationID bigint Aggregation mode: 1 – Empty

2 – Mean value 3 – Sum

4 – Minimum value 5 – Maximum value 6 – Variance

7 – Weighted average value

Page 82: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 82

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

A.4.11 [IS].[udsp_getTagConfigurationChain]

Returns configuration data of tags that are being aggregated from one of the specified tags.

Table A-62: udsp_getTagConfigurationChain Arguments

Parameter Name Data Type Description

@projectUID uniqueidentifier Project ID

@tagIds nvarchar(max) Tag IDs (comma-separated values)

Table A-63: udsp_getTagConfigurationChain Return Values

Field Data Type Description

TagUID bigint (WinCC) or uniqueidentifier (Process Historian)

Tag ID (data type depends on data source)

TagName nvarchar(max) Tag name

ArcTime nvarchar(max) Archiving cycle text (including unit)

ScanTime nvarchar(max) Scan cycle text (including unit)

CompressTime nvarchar(max) Compression cycle text (including unit)

AggregationID bigint Aggregation mode: 1 – Empty

2 – Mean value 3 – Sum

4 – Minimum value 5 – Maximum value 6 – Variance

7 – Weighted average value

Page 83: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 83

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

A.4.12 [IS].[udsp_getTagAggregation]

Returns tag runtime data that has been processed by the specified aggregate function. One row is returned for each interval.

Table A-64: udsp_getTagAggregation Arguments

Parameter Name Data Type Description

@tagIds nvarchar(max) Tag IDs (comma-separated values)

@TimeBegin datetime2 Start time

@TimeEnd datetime2 End time

@Aggregation nvarchar(max) Aggregate function to be applied to samples within the individual intervals:

‘SUM’ – Sum

‘MIN’ – Minimum ‘MAX’ – Maximum

‘AVG’ – Arithmetic mean ‘COUNT’ – Number of samples

Additional aggregate functions only supported by Process Historian:

‘INT_SaH’ – Integral of sample and hold function

‘INT_Lin’ – Integral of linear interpolation function ‘WAV_SaH’ – Arithmetic mean of sample and hold function ‘WAV_Lin’ – Arithmetic mean of linear interpolation function

@Timestep int Length of individual intervals (seconds)

Table A-65: udsp_getTagAggregation Return Values

Field Data Type Description

TagName nvarchar(max) Tag name

Timestamp datetime2 Start of interval

ValueFloat float Tag value

Page 84: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 84

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

A.4.13 [IS].[udsp_getTagTrend]

Returns tag runtime data within the specified time span. In the case of Process Historian data sources, interpolation is used to reduce the number of samples returned, depending on the desired number of samples.

Table A-66: udsp_getTagTrend Arguments

Parameter Name Data Type Description

@tagIds nvarchar(max) Tag IDs (comma-separated values)

@TimeBegin datetime2 Start time

@TimeEnd datetime2 End time

@Pixel int Desired number of samples (only supported by Process Historian)

Table A-67: udsp_getTagTrend Return Values

Field Data Type Description

TagName nvarchar(max) Tag name

Timestamp datetime2 Time

ValueFloat float Tag value

A.4.14 [IS].[udsp_getTagTable]

Returns detailed tag runtime data within the specified time span.

Table A-68: udsp_getTagTable Arguments

Parameter Name Data Type Description

@tagIds nvarchar(max) Tag IDs (comma-separated values)

@TimeBegin datetime2 Start time

@TimeEnd datetime2 End time

Table A-69: udsp_getTagTable Return Values

Field Data Type Description

TagName nvarchar(max) Tag name

Timestamp datetime2 Time

ValueFloat float Tag value

Quality bigint See Flag

Flags int See Flag

Page 85: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 85

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Table A-70: Quality Codes

Category Sub Code Hex Code

Good (NC) O.K. 0x80

Good (NC) function check / local override 0xBC

Good (NC) Maintenance required 0xA4

Good (NC) Maintenance demanded 0xA8

Good (NC) Active advisory alarm 0x88

Good (NC) Active critical alarm 0x8C

Good (NC) Unack update event 0x90

Good (NC) Unack advisory alarm 0x94

Good (NC) Unack critical alarm 0x98

Good (NC) Initiate fail safe 0xA0

Good (C) O.K. 0xC0

Good (C) Initialization acknowledge 0xC4

Good (C) Initialization request 0xC8

Good (C) Not invited 0xCC

Good (C) Do not select 0xD4

Good (C) Local override 0xD8

Good (C) Initiate fail safe 0xE0

Uncertain Non-specific 0x40

Uncertain Last usable value (LUV) 0x44

Uncertain Substitute 0x48

Uncertain Initial value 0x4C

Uncertain Process related, no maintenance 0x78

Uncertain Substitute (constant) 0x4B

Uncertain Sensor conversion not accurate 0x50

Uncertain Engineering unit violation 0x54

Uncertain Sub-normal 0x58

Uncertain Configuration error 0x5C

Uncertain Sensor calibration 0x64

Uncertain Simulated value 0x60

Uncertain Maintenance demanded 0x68

Bad Process related, no maintenance 0x2B

Bad Process related, substitute value 0x28

Bad Non-specific 0x00

Bad Configuration error 0x04

Bad Not connected 0x08

Bad Sensor failure 0x10

Bad Device failure 0x0C

Bad No comm, with LUV 0x14

Bad No comm, no LUV 0x18

Bad Maintenance alarm, more diagnostics available 0x24

Good (NC) Update event 0x84

Uncertain Simulated value, end 0x74

Uncertain Simulated value, start 0x73

Page 86: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 86

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Category Sub Code Hex Code

Bad Out of service 0x1C

Bad Function check / local override 0x3F

Bad Device passivated (diagnostic alerts inhibited) 0x23

NC = non-cascade; C = cascade

Figure A-1: Flag

Identification for the content of the High-Word

Decoding Hex code:

0x0 High Word contains WinCC Status Flag

0x1 High Word contains Quality Code

A.4.15 [IS].[udsp_getUnitOfTags]

Returns the units of the tags (in case of a PH data source the current version of the tag)

Table A-71: udsp_getUnitOfTags Arguments

Parameter Name Data Type Description

@tagIds nvarchar(max) Tag IDs (comma-separated values)

@TimeBegin datetime2 Start time

@TimeEnd datetime2 End time

Table A-72: udsp_getUnitOfTags Return Values

Field Data Type Description

TagID nvarchar(max) Tag ID

Unit datetime2 Time

Page 87: Creation of report templates for the Information Server ... of report templates for the Information Server based on Process Historian data WinCC, PCS 7, Information Server, Process

A Information Server Stored Procedures

Report templates for IS Entry ID: 64906050, V2.1, 03/2018 87

S

iem

en

s A

G 2

01

8 A

ll ri

gh

ts r

ese

rve

d

Table A-73: WinCC Status Flags

Flag Hex Value

No error 0x0000

Connection to partner not established 0x0001

Handshake error 0x0002

Network module defective 0x0004

Configured upper limit exceeded 0x0008

Configured lower limit exceeded 0x0010

Format upper limit exceeded 0x0020

Format lower limit exceeded 0x0040

Display conversion error 0x0080

Tag initialization value 0x0100

Tag replacement value 0x0200

Channel addressing error 0x0400

Tag not found / not available 0x0800

Access to tag not permitted 0x1000

Timeout / no check-back message from the channel 0x2000

Server not available 0x4000

Table A-74: Tag Logging Status Flags

Flag Hex Value

Summer time 0x001

Substitute value 0x002

Value prior to time jump 0x004

Value after time jump 0x008

Values during time overlap 0x010

Value initially archived after archive creation 0x020

Initial value after archiving of RT 0x040

Compressed value 0x080

Time change took place 0x100

Manual tag supply 0x200