You are on page 1of 31

SQL Reporting Services

Exercise

© Siemens AG 2009. All Rights Reserved.

Page 1
Overview SQL Reporting Exercises

Creation of SQL Reports containing WinCC data

1. Create a SQL Reporting project by means of Reporting Project


Wizard with a simple report of one WinCC TagLogging tag
2. Create a new report for multiple TagLogging tags and
reporting AlarmLogging data using Graphical objects
3. Reporting of User Archive data as well as data out of own database tables
4. Creation of a report with parameters as well as the configuration of the required Linked
Server and the Linked Data source
5. Configure the scheduling and subscriptions of the reports

© Siemens AG 2009. All Rights Reserved.


Page 2/41 Industry Sector

Page 2
SQL Reporting Services Exercise

ƒ Overview
ƒ E1: Reporting Wizard
ƒ E2: AlarmLogging & TagLogging Report
ƒ E3: UserArchive Report
ƒ E4: Reports with Parameter
ƒ E5: Report Subscriptions

© Siemens AG 2009. All Rights Reserved.

Page 3
Exercise 1: Create a SQL Reporting project

Use the Reporting Server Wizard to create a report for one WinCC TLG tag

Task:
1. SQL Server Business Intelligence Studio -> New Project
2. Define the WinCC OLE DB Provider as the data source
3. Design the query to get the data of the last 10 seconds for the
TagLogging tag “MARCHIVE\T01”
4. Configure the report layout and format
5. Define the publishing parameters of the report

© Siemens AG 2009. All Rights Reserved.


Page 4/41 Industry Sector

1. Start -> Programs -> SQL Server -> SQL Server Business Intelligence Studio
ƒ Click on Toolbar menu ‘New -> Project’ and select ‘Report Server Project Wizard’
ƒ Project name: WinCC Reports Location: 2_SQL Reporting

2. Define OLE DB as the data source


ƒ Type: OLE DB
ƒ Connection string:
ƒ OLE DB Provider: WINCCOLEDBProvider
ƒ Server: ES\WINCC (Location: empty)
ƒ User name: siemens Password: siemens
ƒ Press ‘Advanced’ and add as ‘Catalog’ : CC_ExternalBrowsing
ƒ Press OK and OK

Page 4
Exercise 1: Create a SQL Reporting project

Use the Reporting Server Wizard to create a report for one WinCC TLG tag

Task:
1. SQL Server Business Intelligence Studio -> New Project
2. Define the WinCC OLE DB Provider as the data source
3. Design the query to get the data of the last 10 seconds for the
TagLogging tag “MARCHIVE\T01”
4. Configure the report layout and format
5. Define the publishing parameters of the report

© Siemens AG 2009. All Rights Reserved.


Page 5/41 Industry Sector

3. Design the query to get the data


ƒ Archive tag “MARCHIVE\T01” shall be queried for the last 10 seconds
ƒ Query syntax same as for the Connectivity Pack
ƒ see document “D:\2_SQL Reporting\queries.doc” for sample queries
ƒ Note: ConnectivityPack Documentation
Query for WinCC OLE-
DB Provider similar to
Connectivity Pack

4. Configure the layout and format


ƒ Report Type: Tabular
(query just contains one tag)
ƒ Design Table: see screenshot (example)
ƒ Table Style: as you like

Page 5
Exercise 1: Create a SQL Reporting project

Use the Reporting Server Wizard to create a report for one WinCC TLG tag

Task:
1. SQL Server Business Intelligence Studio -> New Project
2. Define the WinCC OLE DB Provider as the data source
3. Design the query to get the data of the last 10 seconds for the
TagLogging tag “MARCHIVE\T01”
4. Configure the report layout and format
5. Define the publishing parameters of the report

© Siemens AG 2009. All Rights Reserved.


Page 6/41 Industry Sector

5. Publishing of reports to the Web Portal

ƒ Report Server: default


ƒ Deployment folder: Reporting WinCC

ƒ Report Name: Report TagLogging


ƒ Preview: checked

ƒ Finish

6. Result
ƒ Report Development Studio opened
ƒ Preview
ƒ Build -> Deploy solution
ƒ WebServer: http://localhost/Reports
ƒ Created Report available in the web portal
ƒ Ad-Hoc analysis or time-scheduled reporting
ƒ Export in different formats (pdf, xls, xml, csv)

Page 6
SQL Reporting Services Exercise

ƒ Overview
ƒ E1: Reporting Wizard
ƒ E2: AlarmLogging & TagLogging Report
ƒ E3: UserArchive Report
ƒ E4: Reports with Parameter
ƒ E5: Report Subscriptions

© Siemens AG 2009. All Rights Reserved.

Page 7
Exercise 2: Add new report for Alarm and Tag
Logging data with graphical objects

Add a new report for WinCC Alarm Logging and Tag Logging data

Task:
1. Create a new Shared Data Source
2. Add a new Alarm Report to the previously created Reporting project
3. Add another Dataset for multiple TagLogging tags (new query string)
4. Add a Chart and assign parameters

© Siemens AG 2009. All Rights Reserved.


Page 8/41 Industry Sector

1. Create the new Shared Data source


ƒ Solution Explorer in Shared Data Sources -> Right click
ƒ Shared Data source: The defined connection string
can be used in all the reports of the PROJECT

ƒ Definition Shared Data Source:


ƒ NAME: ShareWinCCds
ƒ Type: “OLE DB”
ƒ Connection string:
- WinCCOLEDBProvider
- Computername\WinCC
- CC_ExternalBrowsing
ƒ User: siemens PW: siemens

Page 8
Exercise 2: Add new report for Alarm and Tag
Logging data with graphical objects

Add a new report for WinCC Alarm Logging and Tag Logging data

Task:
1. Create a new Shared Data Source
2. Add a new Alarm Report to the previously created Reporting project
3. Add another Dataset for multiple TagLogging tags (new query string)
4. Add a Chart and assign parameters

© Siemens AG 2009. All Rights Reserved.


Page 9/41 Industry Sector

2. Create a new Report in the already created Project.

ƒ Right Click “Reports” in the Solution Explorer, then the


‘New Report Wizard’ starts
ƒ As Data Source select the just created shared Data Source

ƒ Design the query,


ƒ Example AlarmLogging: ALARMVIEW:Select * FROM AlgViewEnu
ƒ See document “D:\2_SQL Reporting\queries.doc” for sample Alarm Logging queries
ƒ Note: ConnectivityPack Documentation

Page 9
Exercise 2: Add new report for Alarm and Tag
Logging data with graphical objects

Add a new report for WinCC Alarm Logging and Tag Logging data

Task:
1. Create a new Shared Data Source
2. Add a new Alarm Report to the previously created Reporting project
3. Add another Dataset for multiple TagLogging tags (new query string)
4. Add a Chart and assign parameters

© Siemens AG 2009. All Rights Reserved.


Page 10/41 Industry Sector

2. Create a new Report in the already created Project

ƒ Report Layout and format


ƒ Report Type: Tabular

ƒ Design Table: see screenshot


ƒ Group: MsgNr
ƒ Details: State, DateTime,
Infotext, ServerName.

ƒ Table Style: as you like

ƒ Publishing of report to Web Portal


ƒ Report Server: default
ƒ Deployment folder: as you like

ƒ Completing the Wizard


ƒ Report Name: ReportLogging
ƒ Preview: checked
ƒ Finish

ƒ Result:

Page 10
Exercise 2: Add new report for Alarm and Tag
Logging data with graphical objects

Add a new report for WinCC Alarm Logging and Tag Logging data

Task:
1. Create a new Shared Data Source
2. Add a new Alarm Report to the previously created Reporting project
3. Add another Dataset for multiple TagLogging tags (new query string)
4. Add a Chart and assign parameters

© Siemens AG 2009. All Rights Reserved.


Page 11/41 Industry Sector

1. SQL Server Business Intelligence Studio -> Project: “WinCC Reports” -> “Data” Tab

ƒ Dropdown list: <New Dataset…>

ƒ Using the same data source


ƒ Add a new query string for two TagLogging tags (MARCHIVE\T02 and MARCHIVE\T03)
ƒ TAG:R,('MARCHIVE\T02';'MARCHIVE\T03'), '0000-00-00 00:00:05.000','0000-00-00 00:00:00.000'

Page 11
Exercise 2: Add new report for Alarm and Tag
Logging data with graphical objects

Add a new report for WinCC Alarm Logging and Tag Logging data

Task:
1. Create a new Shared Data Source
2. Add a new Alarm Report to the previously created Reporting project
3. Add another Dataset for multiple TagLogging tags (new query string)
4. Add a Chart and assign parameters

© Siemens AG 2009. All Rights Reserved.


Page 12/41 Industry Sector

2. Add a chart and assign parameter from dataset


ƒ Select the “Layout Tab” and add a
Chart control via drag and drop
from the Toolbox

ƒ Right Click and select Properties of the Chart object:

ƒ General Tab in chart Properties:


ƒ Title: “T02 and T03 Tags”
ƒ Chart Type: Line

Page 12
Exercise 2: Add new report for Alarm and Tag
Logging data with graphical objects

Add a new report for WinCC Alarm Logging and Tag Logging data

Task:
1. Create a new Shared Data Source
2. Add a new Alarm Report to the previously created Reporting project
3. Add another Dataset for multiple TagLogging tags (new query string)
4. Add a Chart and assign parameters

© Siemens AG 2009. All Rights Reserved.


Page 13/41 Industry Sector

ƒ Data Tab in chart properties:


ƒ Dataset name: Select the created
dataset in the dropdown list.
ƒ Values: Enter a name and the
value Expression:
“ =Fields!RealValue.Value”

Page 13
Exercise 2: Add new report for Alarm and Tag
Logging data with graphical objects

Add a new report for WinCC Alarm Logging and Tag Logging data

Task:
1. Create a new Shared Data Source
2. Add a new Alarm Report to the previously created Reporting project
3. Add another Dataset for multiple TagLogging tags (new query string)
4. Add a Chart and assign parameters

© Siemens AG 2009. All Rights Reserved.


Page 14/41 Industry Sector

ƒ Data Tab in chart properties:

ƒ Category groups:
ƒ The time must be added.
ƒ In the Expression and Label, add:
“=Fields!Timestamp.Value”

ƒ Series Groups:
ƒ One line for each Process tag:
ƒ Add the Expression and Label:
“=Fields!ValueID.Value”

Page 14
Exercise 2: Add new report for Alarm and Tag
Logging data with graphical objects

Add a new report for WinCC Alarm Logging and Tag Logging data

Task:
1. Create a new Shared Data Source
2. Add a new Alarm Report to the previously created Reporting project
3. Add another Dataset for multiple TagLogging tags (new query string)
4. Add a Chart and assign parameters

© Siemens AG 2009. All Rights Reserved.


Page 15/41 Industry Sector

ƒ Result:

Page 15
SQL Reporting Services Exercise

ƒ Overview
ƒ E1: Reporting Wizard
ƒ E2: AlarmLogging & TagLogging Report
ƒ E3: UserArchive Report
ƒ E4: Reports with Parameter
ƒ E5: Report Subscriptions

© Siemens AG 2009. All Rights Reserved.

Page 16
Exercise 3: Reporting of User Archive data

Add a new report for WinCC User Archive data

Task
1. Create a Report for WinCC User Archive data
2. Add parameters to the Report

Note: We can use the


Microsoft OLE DB Provider

© Siemens AG 2009. All Rights Reserved.


Page 17/41 Industry Sector

1. Add a new Report

ƒ Definition data source


ƒ Type: “OLE DB”
ƒ Connection string:
ƒ Microsoft OLE DB Provider for SQL Server
ƒ Computername\WinCC
ƒ WinCC RT database
ƒ Use Windows NT Int. Sec.

Page 17
Exercise 3: Reporting of User Archive data

Add a new report for WinCC User Archive data

Task
1. Create a Report for WinCC User Archive data
2. Add parameters to the Report

Note: We can use the


Microsoft OLE DB Provider

© Siemens AG 2009. All Rights Reserved.


Page 18/41 Industry Sector

1. Add a new Report

ƒ Design the Query:


SELECT * FROM UA#Brewery

ƒ Complete the report Wizard and publish the


report
ƒ Name: UserArchive

ƒ Result:

Page 18
Exercise 3: Reporting of User Archive data

Add a new report for WinCC User Archive data

Task
1. Create a Report for WinCC User Archive data
2. Add parameters to the Report

Note: We can use the


Microsoft OLE DB Provider

© Siemens AG 2009. All Rights Reserved.


Page 19/41 Industry Sector

2. Add parameters to the User Archive report

ƒ Select Data Tab


ƒ Change the query:

SELECT * FROM UA#Brewery Where Beer LIKE ?

ƒ Note: “?”, because OLEDB doesn’t allow


named parameters

ƒ In the menu, open the


Report -> Report Parameter

Page 19
Exercise 3: Reporting of User Archive data

Add a new report for WinCC User Archive data

Task
1. Create a Report for WinCC User Archive data
2. Add parameters to the Report

Note: We can use the


Microsoft OLE DB Provider

© Siemens AG 2009. All Rights Reserved.


Page 20/41 Industry Sector

2. Add parameters to the User Archive report

ƒ Configure the Report Parameter:


ƒ Name: Parameter1 (Don’t change it)
ƒ Data type: String
ƒ Prompt: Name to display in the report. Beer Name
ƒ Available values: Enter 3 options (Label and Value)
ƒ Dark beer
ƒ Light beer
ƒ All –> Value = %

Page 20
Exercise 3: Reporting of User Archive data

Add a new report for WinCC User Archive data

Task
1. Create a Report for WinCC User Archive data
2. Add parameters to the Report

Note: We can use the


Microsoft OLE DB Provider

© Siemens AG 2009. All Rights Reserved.


Page 21/41 Industry Sector

ƒ Result

Page 21
SQL Reporting Services Exercise

ƒ Overview
ƒ E1: Reporting Wizard
ƒ E2: AlarmLogging & TagLogging Report
ƒ E3: UserArchive Report
ƒ E4: Reports with Parameter
ƒ E5: Report Subscriptions

© Siemens AG 2009. All Rights Reserved.

Page 22
Exercise 4: Create a report with parameters

Creation of a report with parameters as well as the configuration of


the required Linked Server and the Linked Data source

Task:
1. Create a shared data source for the Linked Server
2. Create a Report with a Dummy Query
3. Edit the Report DATA and LAYOUT to add the query with parameters
4. Add navigation to Reports

© Siemens AG 2009. All Rights Reserved.


Page 23/41 Industry Sector

1. Create the new Shared Data source


ƒ Solution Explorer in Shared Data Sources -> Right click
ƒ Definition Shared Data Source:
ƒ NAME: LinkedServerDS
ƒ Type: “Microsoft SQL Server”
ƒ Connection string:
ƒ Computername\WinCC
ƒ Database: master
ƒ User: Windows Authentication

Page 23
Exercise 4: Create a report with parameters

Creation of a report with parameters as well as the configuration of


the required Linked Server and the Linked Data source

Task:
1. Create a shared data source for the Linked Server
2. Create a Report with a Dummy Query
3. Edit the Report DATA and LAYOUT to add the query with parameters
4. Add navigation to Reports

© Siemens AG 2009. All Rights Reserved.


Page 24/41 Industry Sector

2. Create a Report with a Dummy Query


ƒ Datasources: Select the LinkedServerDS.

ƒ Query : Add the Dummy Query.

Select * From CAConfig

ƒ Finish the Wizard


ƒ Report Name: ReportParameters

Page 24
Exercise 4: Create a report with parameters

Creation of a report with parameters as well as the configuration of


the required Linked Server and the Linked Data source

Task:
1. Create a shared data source for the Linked Server
2. Create a Report with a Dummy Query
3. Edit the Report DATA and LAYOUT to add the query with parameters
4. Add navigation to Reports

© Siemens AG 2009. All Rights Reserved.


Page 25/41 Industry Sector

3. Edit the Report DATA and Layout to add the query with parameters
ƒ Delete the old Query, Copy and paste the new query

DECLARE @Stmt varchar(max)


SET @Stmt = 'Select * from Openquery(LSWINCC1,''ALARMVIEW:Select * FROM
AlgViewEnu Where MsgNr = ' +@ValueID+''')'
ƒ EXEC
Execute it and enter a Parameter Value, for example: 2
(@Stmt)

ƒ In Report Datasets window, Click Refresh

Page 25
Exercise 4: Create a report with parameters

Creation of a report with parameters as well as the configuration of


the required Linked Server and the Linked Data source

Task:
1. Create a shared data source for the Linked Server
2. Create a Report with a Dummy Query
3. Edit the Report DATA and LAYOUT to add the query with parameters
4. Add navigation to Reports

© Siemens AG 2009. All Rights Reserved.


Page 26/41 Industry Sector

3. Edit the Report data and LAYOUT to add the query with parameters
ƒ Delete the “Dummy” table

ƒ Copy and paste the table of ReportAlarmLogging

ƒ Change the dataset of the copied Table:


ƒ Select the LinkedServerDS dataset

ƒ Preview
ƒ Enter Parameter Value: 2-5

Page 26
Exercise 4: Create a report with parameters

Creation of a report with parameters as well as the configuration of


the required Linked Server and the Linked Data source

Task:
1. Create a shared data source for the Linked Server
2. Create a Report with a Dummy Query
3. Edit the Report DATA and LAYOUT to add the query with parameters
4. Add navigation to Reports

© Siemens AG 2009. All Rights Reserved.


Page 27/41 Industry Sector

5. Add navigation to Reports


„ Add Textbox in the REPORTLOGGING report called reportparameters:
„ Properties of the Textbox Æ Navigation TAB Æ Jump To Report: Report Parameters.

Page 27
Exercise 4: Create a report with parameters

Creation of a report with parameters as well as the configuration of


the required Linked Server and the Linked Data source

Task:
1. Create a shared data source for the Linked Server
2. Create a Report with a Dummy Query
3. Edit the Report DATA and LAYOUT to add the query with parameters
4. Add navigation to Reports

© Siemens AG 2009. All Rights Reserved.


Page 28/41 Industry Sector

5. Add navigation to Reports


„ Table Column in REPORTLOGGING report pointing REPORTPARAMETERS and give a parameter Value
„ Properties Æ Navigation TAB Æ Jump To Report: Report Parameters.

Parameter Name: ValueID


Parameter Value:“=Fields!MsgNr.Value”

Page 28
SQL Reporting Services Exercise

ƒ Overview
ƒ E1: Reporting Wizard
ƒ E2: AlarmLogging & TagLogging Report
ƒ E3: UserArchive Report
ƒ E4: Reports with Parameter
ƒ E5: Report Subscriptions

© Siemens AG 2009. All Rights Reserved.

Page 29
Exercise 6: Create Subscriptions

Configure the scheduling and subscriptions of the reports

Task:
1. Open Report Manager Web Server in Internet Explorer: http://ES/Reports
2. Open the report for which you want to make a subscription
3. Create a “New Subscription”
4. Configure the subscription parameters: Delivery options and Schedule definition
5. Check Outlook Express for the received report

© Siemens AG 2009. All Rights Reserved.


Page 30/41 Industry Sector

1. Open Internet Explorer: http://ES/Reports


2. Open one Report View: Home > Reporting WinCC > REPORTNAME
3. In “subscriptions” Tab click “New Subscription”.

4. Subscription Parameters:
Report Delivery Options:
ƒ Delivered by: E-Mail
ƒ To: MrReport@ES
ƒ Other parameters Default Values.

Page 30
Exercise 6: Create Subscriptions

Configure the scheduling and subscriptions of the reports

Task:
1. Open Report Manager Web Server in Internet Explorer: http://ES/Reports
2. Open the report for which you want to make a subscription
3. Create a “New Subscription”
4. Configure the subscription parameters: Delivery options and Schedule definition
5. Check Outlook Express for the received report

© Siemens AG 2009. All Rights Reserved.


Page 31/41 Industry Sector

4. Subscription Parameters:
Subscription Processing Options:
Click “Select Schedule”
ƒ Shedule Details: Day, “Tue”,
“Actual Start Time”
ƒ Start and end dates: Begin on : “Actual Day”

Note: If Report with parameters, also introduce the parameter Value

ƒ Open Outlook Express

Page 31

You might also like