Exercises SQL Reporting
-
Upload
rajib-barat -
Category
Documents
-
view
546 -
download
23
Transcript of Exercises SQL Reporting
Page 1
© Siemens AG 2009. All Rights Reserved.
SQL Reporting Services Exercise
Page 2
© Siemens AG 2009. All Rights Reserved.Industry SectorPage 2/41
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
Page 3
© Siemens AG 2009. All Rights Reserved.
E5: Report Subscriptions
E4: Reports with Parameter
E3: UserArchive Report
E2: AlarmLogging & TagLogging Report
E1: Reporting Wizard
Overview
SQL Reporting Services Exercise
Page 4
© Siemens AG 2009. All Rights Reserved.Industry SectorPage 4/41
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 Project2. Define the WinCC OLE DB Provider as the data source3. Design the query to get the data of the last 10 seconds for the
TagLogging tag “MARCHIVE\T01”4. Configure the report layout and format5. Define the publishing parameters of the report
1. Start -> Programs -> SQL Server -> SQL Server Business Intelligence StudioClick 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 sourceType: OLE DB Connection string:
OLE DB Provider: WINCCOLEDBProviderServer: ES\WINCC (Location: empty)User name: siemens Password: siemens
Press ‘Advanced’ and add as ‘Catalog’ : CC_ExternalBrowsingPress OK and OK
Page 5
© Siemens AG 2009. All Rights Reserved.Industry SectorPage 5/41
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 Project2. Define the WinCC OLE DB Provider as the data source3. Design the query to get the data of the last 10 seconds for the
TagLogging tag “MARCHIVE\T01”4. Configure the report layout and format5. Define the publishing parameters of the report
3. Design the query to get the dataArchive tag “MARCHIVE\T01” shall be queried for the last 10 secondsQuery syntax same as for the Connectivity Packsee document “D:\2_SQL Reporting\queries.doc” for sample queriesNote: ConnectivityPack Documentation
4. Configure the layout and formatReport Type: Tabular (query just contains one tag)Design Table: see screenshot (example)Table Style: as you like
Query for WinCC OLE-DB Provider similar to
Connectivity Pack
Page 6
© Siemens AG 2009. All Rights Reserved.Industry SectorPage 6/41
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 Project2. Define the WinCC OLE DB Provider as the data source3. Design the query to get the data of the last 10 seconds for the
TagLogging tag “MARCHIVE\T01”4. Configure the report layout and format5. Define the publishing parameters of the report
5. Publishing of reports to the Web Portal
Report Server: defaultDeployment folder: Reporting WinCC
Report Name: Report TagLoggingPreview: checked
Finish
6. ResultReport Development Studio openedPreviewBuild -> Deploy solutionWebServer: http://localhost/ReportsCreated Report available in the web portal Ad-Hoc analysis or time-scheduled reportingExport in different formats (pdf, xls, xml, csv)
Page 7
© Siemens AG 2009. All Rights Reserved.
E5: Report Subscriptions
E4: Reports with Parameter
E3: UserArchive Report
E2: AlarmLogging & TagLogging Report
E1: Reporting Wizard
Overview
SQL Reporting Services Exercise
Page 8
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: ShareWinCCdsType: “OLE DB”Connection string:
- WinCCOLEDBProvider- Computername\WinCC- CC_ExternalBrowsing
User: siemens PW: siemens
© Siemens AG 2009. All Rights Reserved.Industry SectorPage 8/41
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 Source2. 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
Page 9
2. Create a new Report in the already created Project.
Right Click “Reports” in the Solution Explorer, then the ‘New Report Wizard’ startsAs Data Source select the just created shared Data Source
Design the query,Example AlarmLogging: ALARMVIEW:Select * FROM AlgViewEnuSee document “D:\2_SQL Reporting\queries.doc” for sample Alarm Logging queriesNote: ConnectivityPack Documentation
© Siemens AG 2009. All Rights Reserved.Industry SectorPage 9/41
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 Source2. 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
Page 10
2. Create a new Report in the already created Project
Report Layout and formatReport Type: Tabular
Design Table: see screenshotGroup: MsgNrDetails: State, DateTime, Infotext, ServerName.
Table Style: as you like
Publishing of report to Web PortalReport Server: defaultDeployment folder: as you like
Completing the WizardReport Name: ReportLoggingPreview: checkedFinish
Result:
© Siemens AG 2009. All Rights Reserved.Industry SectorPage 10/41
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 Source2. 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
Page 11
© Siemens AG 2009. All Rights Reserved.Industry SectorPage 11/41
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 Source2. Add a new Alarm Report to the previously created Reporting project3. Add another Dataset for multiple TagLogging tags (new query string)4. Add a Chart and assign parameters
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 12
© Siemens AG 2009. All Rights Reserved.Industry SectorPage 12/41
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 Source2. Add a new Alarm Report to the previously created Reporting project3. Add another Dataset for multiple TagLogging tags (new query string)4. Add a Chart and assign parameters
2. Add a chart and assign parameter from datasetSelect the “Layout Tab” and add a Chart control via drag and dropfrom 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 13
© Siemens AG 2009. All Rights Reserved.Industry SectorPage 13/41
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 Source2. Add a new Alarm Report to the previously created Reporting project3. Add another Dataset for multiple TagLogging tags (new query string)4. Add a Chart and assign parameters
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 14
© Siemens AG 2009. All Rights Reserved.Industry SectorPage 14/41
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 Source2. Add a new Alarm Report to the previously created Reporting project3. Add another Dataset for multiple TagLogging tags (new query string)4. Add a Chart and assign parameters
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 15
© Siemens AG 2009. All Rights Reserved.Industry SectorPage 15/41
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 Source2. Add a new Alarm Report to the previously created Reporting project3. Add another Dataset for multiple TagLogging tags (new query string)4. Add a Chart and assign parameters
Result:
Page 16
© Siemens AG 2009. All Rights Reserved.
E5: Report Subscriptions
E4: Reports with Parameter
E3: UserArchive Report
E2: AlarmLogging & TagLogging Report
E1: Reporting Wizard
Overview
SQL Reporting Services Exercise
Page 17
1. Add a new Report
Definition data source Type: “OLE DB”Connection string:Microsoft OLE DB Provider for SQL ServerComputername\WinCCWinCC RT database
Use Windows NT Int. Sec.
© Siemens AG 2009. All Rights Reserved.Industry SectorPage 17/41
Exercise 3: Reporting of User Archive data
Add a new report for WinCC User Archive data
Task1. Create a Report for WinCC User Archive data2. Add parameters to the Report
Note: We can use the Microsoft OLE DB Provider
Page 18
1. Add a new Report
Design the Query:SELECT * FROM UA#Brewery
Complete the report Wizard and publish thereportName: UserArchive
Result:
© Siemens AG 2009. All Rights Reserved.Industry SectorPage 18/41
Exercise 3: Reporting of User Archive data
Add a new report for WinCC User Archive data
Task1. Create a Report for WinCC User Archive data2. Add parameters to the Report
Note: We can use the Microsoft OLE DB Provider
Page 19
2. Add parameters to the User Archive report
Select Data TabChange 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
© Siemens AG 2009. All Rights Reserved.Industry SectorPage 19/41
Exercise 3: Reporting of User Archive data
Add a new report for WinCC User Archive data
Task1. Create a Report for WinCC User Archive data2. Add parameters to the Report
Note: We can use the Microsoft OLE DB Provider
Page 20
2. Add parameters to the User Archive report
Configure the Report Parameter: Name: Parameter1 (Don’t change it)Data type: StringPrompt: Name to display in the report. Beer NameAvailable values: Enter 3 options (Label and Value)
Dark beerLight beerAll –> Value = %
© Siemens AG 2009. All Rights Reserved.Industry SectorPage 20/41
Exercise 3: Reporting of User Archive data
Add a new report for WinCC User Archive data
Task1. Create a Report for WinCC User Archive data2. Add parameters to the Report
Note: We can use the Microsoft OLE DB Provider
Page 21
Result
© Siemens AG 2009. All Rights Reserved.Industry SectorPage 21/41
Exercise 3: Reporting of User Archive data
Add a new report for WinCC User Archive data
Task1. Create a Report for WinCC User Archive data2. Add parameters to the Report
Note: We can use the Microsoft OLE DB Provider
Page 22
© Siemens AG 2009. All Rights Reserved.
E5: Report Subscriptions
E4: Reports with Parameter
E3: UserArchive Report
E1: Reporting Wizard
Overview
SQL Reporting Services Exercise
E2: AlarmLogging & TagLogging Report
Page 23
© Siemens AG 2009. All Rights Reserved.Industry SectorPage 23/41
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 Server2. Create a Report with a Dummy Query3. Edit the Report DATA and LAYOUT to add the query with parameters4. Add navigation to Reports
1. Create the new Shared Data source
Solution Explorer in Shared Data Sources -> Right click
Definition Shared Data Source:NAME: LinkedServerDSType: “Microsoft SQL Server”Connection string:
Computername\WinCCDatabase: master
User: Windows Authentication
Page 24
© Siemens AG 2009. All Rights Reserved.Industry SectorPage 24/41
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 Server2. Create a Report with a Dummy Query3. Edit the Report DATA and LAYOUT to add the query with parameters4. Add navigation to Reports
2. Create a Report with a Dummy Query
Datasources: Select the LinkedServerDS.
Query : Add the Dummy Query.
Finish the Wizard
Report Name: ReportParameters
Select * From CAConfig
Page 25
© Siemens AG 2009. All Rights Reserved.Industry SectorPage 25/41
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 Server2. Create a Report with a Dummy Query3. Edit the Report DATA and LAYOUT to add the query with parameters4. Add navigation to Reports
3. Edit the Report DATA and Layout to add the query with parametersDelete the old Query, Copy and paste the new query
Execute it and enter a Parameter Value, for example: 2
In Report Datasets window, Click Refresh
DECLARE @Stmt varchar(max)
SET @Stmt = 'Select * from Openquery(LSWINCC1,''ALARMVIEW:Select * FROM AlgViewEnu Where MsgNr = ' +@ValueID+''')'
EXEC (@Stmt)
Page 26
© Siemens AG 2009. All Rights Reserved.Industry SectorPage 26/41
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 Server2. Create a Report with a Dummy Query3. Edit the Report DATA and LAYOUT to add the query with parameters4. Add navigation to Reports
3. Edit the Report data and LAYOUT to add the query with parametersDelete the “Dummy” table
Copy and paste the table of ReportAlarmLogging
Change the dataset of the copied Table: Select the LinkedServerDS dataset
PreviewEnter Parameter Value: 2-5
Page 27
© Siemens AG 2009. All Rights Reserved.Industry SectorPage 27/41
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 Server2. Create a Report with a Dummy Query3. Edit the Report DATA and LAYOUT to add the query with parameters4. Add navigation to Reports
5. Add navigation to ReportsAdd Textbox in the REPORTLOGGING report called reportparameters:Properties of the Textbox Navigation TAB Jump To Report: Report Parameters.
Page 28
© Siemens AG 2009. All Rights Reserved.Industry SectorPage 28/41
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 Server2. Create a Report with a Dummy Query3. Edit the Report DATA and LAYOUT to add the query with parameters4. Add navigation to Reports
5. Add navigation to ReportsTable Column in REPORTLOGGING report pointing REPORTPARAMETERS and give a parameter ValueProperties Navigation TAB Jump To Report: Report Parameters.
Parameter Name: ValueID
Parameter Value:“=Fields!MsgNr.Value”
Page 29
© Siemens AG 2009. All Rights Reserved.
E5: Report Subscriptions
E4: Reports with Parameter
E3: UserArchive Report
E1: Reporting Wizard
Overview
SQL Reporting Services Exercise
E2: AlarmLogging & TagLogging Report
Page 30
© Siemens AG 2009. All Rights Reserved.Industry SectorPage 30/41
Exercise 6: Create Subscriptions
Configure the scheduling and subscriptions of the reports
Task:1. Open Report Manager Web Server in Internet Explorer: http://ES/Reports2. Open the report for which you want to make a subscription3. Create a “New Subscription”4. Configure the subscription parameters: Delivery options and Schedule definition5. Check Outlook Express for the received report
1. Open Internet Explorer: http://ES/Reports2. Open one Report View: Home > Reporting WinCC > REPORTNAME3. In “subscriptions” Tab click “New Subscription”.
4. Subscription Parameters:Report Delivery Options:
Delivered by: E-MailTo: MrReport@ESOther parameters Default Values.
Page 31
© Siemens AG 2009. All Rights Reserved.Industry SectorPage 31/41
Exercise 6: Create Subscriptions
Configure the scheduling and subscriptions of the reports
Task:1. Open Report Manager Web Server in Internet Explorer: http://ES/Reports2. Open the report for which you want to make a subscription3. Create a “New Subscription”4. Configure the subscription parameters: Delivery options and Schedule definition5. Check Outlook Express for the received report
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