TF07 Leveraging SQL Server Reporting Services (SSRS)

83
Leveraging SQL Server Reporting Services (SSRS) For Classroom Use Only!

description

TF07 Leveraging SQL Server Reporting Services (SSRS)

Transcript of TF07 Leveraging SQL Server Reporting Services (SSRS)

Page 1: TF07 Leveraging SQL Server Reporting Services (SSRS)

Leveraging SQL Server Reporting Services (SSRS)

For Classroom Use Only!

Page 2: TF07 Leveraging SQL Server Reporting Services (SSRS)

Important User Information

This documentation, whether, illustrative, printed, “online” or electronic (hereinafter “Documentation”) is intended for use only as a learning aid when using Rockwell Automation approved demonstration hardware, software and firmware. The Documentation should only be used as a learning tool by qualified professionals. The variety of uses for the hardware, software and firmware (hereinafter “Products”) described in this Documentation, mandates that those responsible for the application and use of those Products must satisfy themselves that all necessary steps have been taken to ensure that each application and actual use meets all performance and safety requirements, including any applicable laws, regulations, codes and standards in addition to any applicable technical documents. In no event will Rockwell Automation, Inc., or any of its affiliate or subsidiary companies (hereinafter “Rockwell Automation”) be responsible or liable for any indirect or consequential damages resulting from the use or application of the Products described in this Documentation. Rockwell Automation does not assume responsibility or liability for damages of any kind based on the alleged use of, or reliance on, this Documentation. No patent liability is assumed by Rockwell Automation with respect to use of information, circuits, equipment, or software described in the Documentation.

Except as specifically agreed in writing as part of a maintenance or support contract, equipment users are responsible for:

• properly using, calibrating, operating, monitoring and maintaining all Products consistent with all Rockwell Automation

or third-party provided instructions, warnings, recommendations and documentation;

• ensuring that only properly trained personnel use, operate and maintain the Products at all times;

• staying informed of all Product updates and alerts and implementing all updates and fixes; and • all other factors affecting the Products that are outside of the direct control of Rockwell Automation.

Reproduction of the contents of the Documentation, in whole or in part, without written permission of Rockwell Automation is prohibited. Throughout this manual we use the following notes to make you aware of safety considerations:

Identifies information about practices or circumstances that can cause an explosion in a hazardous environment, which may lead to personal injury or death, property damage, or economic loss.

Identifies information that is critical for successful application and understanding of the product.

Identifies information about practices or circumstances that can lead to personal injury or death, property damage, or economic loss. Attentions help you: • identify a hazard • avoid a hazard • recognize the consequence

Labels may be located on or inside the drive to alert people that dangerous voltage may be present.

Labels may be located on or inside the drive to alert people that surfaces may be dangerous temperatures.

N999 – Your lab title goes here

Presenter: <<Your name>> <<Your business group>>

Page 3: TF07 Leveraging SQL Server Reporting Services (SSRS)

3 of 83

Leveraging SQL Server Reporting Services (SSRS)

Contents

Before you begin ........................................................................................................................................... 4

Tools & prerequisites ........................................................................................................................................................................ 4

Lab Image Information ...................................................................................................................................................................... 4

Overview ....................................................................................................................................................... 5

Introduction to Report Manager .................................................................................................................... 6

Connecting to Report Manager ......................................................................................................................................................... 6

Exploring Reporting Content ............................................................................................................................................................. 7

Tables ............................................................................................................................................................ 9

Creating a Shared Data Source ........................................................................................................................................................ 9

Creating a Shared Dataset ............................................................................................................................................................. 12

Creating a Table Report .................................................................................................................................................................. 16

Adding Row Grouping and Summary Information .......................................................................................................................... 32

Report Parameters ...................................................................................................................................... 42

Creating Report Parameters ........................................................................................................................................................... 42

Automatically Populating Parameters ............................................................................................................................................. 49

Selecting Multiple Parameters ........................................................................................................................................................ 52

Cascading Parameters ................................................................................................................................................................... 55

Charts .......................................................................................................................................................... 57

Adding a Pie Chart .......................................................................................................................................................................... 57

Adding Sparklines and Data Bars ................................................................................................................................................... 63

Drillthrough Reports .................................................................................................................................... 67

Security ....................................................................................................................................................... 75

Page 4: TF07 Leveraging SQL Server Reporting Services (SSRS)

4 of 83

Before you begin

The VMWare image for this Lab uses SQL Server 2008 R2. The image also includes various Rockwell Automation software

products for demonstration purposes.

Tools & prerequisites

Software programs used in this lab:

Microsoft Windows Server 2008 R2 SP1

Microsoft SQL 2008 R2 Standard Edition

Microsoft Internet Explorer 9.0

Files required:

‘Lab Files’ folder located on the desktop of the lab image

Lab Image Information

Start the VMware image if it is not already running. The image is configured for auto logon. Should the auto logon fail and you

receive the logon screen, log on with the following credentials:

Username: Labuser

Password: rockwell

The VMWare image for this lab contains multiple Rockwell Software products and may take several minutes to load. A dialog

box similar to the one shown below will launch when the Operating System is ready. When the dialog box automatically closes

the lab VMWare image should be ready to use, although several more minutes may be required based on the performance of the

host system.

The lab image contains a script that automatically generates data for the last 10 days. If this lab is not completed within several

hours after the image boots, some reports may appear to not function due to the fact that the data is outside of the reporting time

range. Rebooting the image will cause the reporting data to update to the current time.

There are several sections of this lab which requires users to enter text. There is a document named Lab Text.docx in the Lab Files folder (on the image desktop) which contains all of the lab text. Lab users may find it useful to open the document when starting the lab and copying/pasting the text from the word document rather than typing in the information.

Users may be prompted for credentials while in Report Manager during this lab. This occurs when the user has not performed an action on the server for several minutes and the user’s credentials time out. Users can select Cancel to automatically be logged in with their Windows credentials to continue the lab exercises.

Page 5: TF07 Leveraging SQL Server Reporting Services (SSRS)

5 of 83

Overview

Reporting Services is a server-based reporting platform that provides comprehensive reporting functionality for a variety of data

sources. SQL Server Reporting Services provides a full range of ready-to-use tools and services to help you create, deploy, and

manage reports for your organization, as well as programming features that enable you to extend and customize your reporting

functionality. Reporting Services tools work within the Microsoft Visual Studio environment and are fully integrated with SQL

Server tools and components.

With Reporting Services, you can create interactive, tabular, graphical, or free-form reports from relational, multidimensional, or

XML-based data sources. Reports can include rich data visualization, including charts, maps, and sparklines. You can publish

reports, schedule report processing, or access reports on-demand. You can select from a variety of viewing formats, export

reports to other applications such as Microsoft Excel, and subscribe to published reports. The reports that you create can be

viewed over a Web-based connection or as part of a Microsoft Windows application or SharePoint site. You can also create data

alerts on reports published to a SharePoint site and receive email messages when report data changes.

This Hands-on lab provides an opportunity to learn how to use SQL Server Reporting Services (SSRS) by walking users through

the basic foundation blocks of Reporting Services including connecting to Report Manager, using Report Builder to create reports

and charts, and understanding security.

Page 6: TF07 Leveraging SQL Server Reporting Services (SSRS)

6 of 83

Introduction to Report Manager

Report Manager is a Web-based report access and management tool that you use to administer a single report server instance

from a remote location over an HTTP connection. You can also use Report Manager for its report viewer and navigation features.

You can use Report Manager to perform the following tasks:

View, search, print, and subscribe to reports.

Create, secure, and maintain the folder hierarchy to organize items on the server.

Configure role-based security that determines access to items and operations.

Configure report execution properties, report history, and report parameters.

Create report models that connect to and retrieve data from a Microsoft SQL Server Analysis Services data source or

from a SQL Server relational data source.

Set model item security to allow access to specific entities in the model, or map entities to predefined click through

reports that you create in advance.

Create shared schedules and shared data sources to make schedules and data source connections more

manageable.

Create data-driven subscriptions that roll out reports to a large recipient list.

Create linked reports to reuse and repurpose an existing report in different ways.

Launch Report Builder to create reports that you can save and run on the report server.

You can use Report Manager to browse the report server folders or search for specific reports. You can view a report, its general

properties, and paste copies of the report that are captured in report history. Depending on your permissions, you might also be

able to subscribe to reports for delivery to an e-mail inbox or a shared folder on the file system. Note that some Report Manager

features are only available in specified editions of SQL Server.

Connecting to Report Manager

Report Manager is a Web application that you open by typing the Report Manager URL in the address bar of a browser window.

1. Start Internet Explorer.

2. By default, the Report Manager URL is http://<ComputerName>/reports. Browse to http://w2k8-

ftvp1/Reports.

The Report Manager home page will be displayed (there may be a delay during which it appears nothing is

happening the first time Report Manager is accessed).

Page 7: TF07 Leveraging SQL Server Reporting Services (SSRS)

7 of 83

The following table describes the icons that are used in Report Manager

Exploring Reporting Content

The image for this lab contains pre-built SQL Server Reporting Services reports. To gain an understanding of some of the

available reporting abilities, let’s explore sample reporting content.

1. The FTEnergy folder contains reports for FactoryTalk EnergyMetrix. FactoryTalk EnergyMetrix is a

sophisticated Web-enabled, energy management software package that gives you access to critical energy

information from virtually any location. Select the FTEnergy folder.

2. You will see that there are several folders containing Data Sources and Datasets for the two available

Factorytalk EnergyMetrix reports. We will be discussing and creating Data Sources and Datasets in later

lab exercises. Select MeterReport. (There may be a delay loading the report the first time the data source

is accessed after the image is started)

Page 8: TF07 Leveraging SQL Server Reporting Services (SSRS)

8 of 83

The meter report brings together various reporting objects such as tables, charts and scales to create a

single comprehensive report based on a common data set. Some of these items will be used to create a

report in this lab.

3. At the top of the report there is a drop down selection for Meter. This report has been created with Meter as

a parameter to allow users to view this report for any meter in their system. Select the Line 2 Labeler

meter (the last item in the list) and then select View Report.

The report will be updated for the newly selected meter.

4. Select Home in the Report Manager header to return to the Report Manager home page (or use the

browser back button).

Page 9: TF07 Leveraging SQL Server Reporting Services (SSRS)

9 of 83

Tables

A table can be used to display detail data or grouped data, or a combination of both. You can group data by a single field, by

multiple fields, or by writing your own expression. You can create nested groups or independent, adjacent groups. To display

aggregated values for grouped data you can add totals to groups. Rows and columns can be formatted to highlight the data you

want to emphasize. You can initially hide detail or grouped data and include drilldown toggles to enable a user to interactively

choose how much data to show.

In this exercise we will be using a demonstration database built into the lab image that simulates a Steam Assisted Gravity

Drainage (SAGD) system. SAGD is an enhanced oil recovery technology for producing heavy crude oil and bitumen. It is an

advanced form of steam stimulation in which a pair of horizontal wells are drilled into the oil reservoir, one a few meters above

the other. High pressure steam is continuously injected into the upper wellbore to heat the oil and reduce its viscosity, causing

the oil to drain into the lower wellbore, where it is pumped out. We will be using the table object to create a downtime cost report

for the oil wells.

Creating a Shared Data Source

To include data in a report, you must first create data connections, also known as data sources. A data connection includes the

data source type, connection information, and the type of credentials to use. There are two types of data sources: embedded and

shared. An embedded data source is defined in the report and used only by that report. A shared data source is defined

independently from a report and can be used by multiple reports.

In this exercise we are going to create a shared data source that will be used for all reporting content.

1. The first task is to create a folder structure to hold the reporting content for this lab. In the Report Manager

home page, select New Folder.

2. Name the folder Lab Reporting and select OK.

Page 10: TF07 Leveraging SQL Server Reporting Services (SSRS)

10 of 83

3. Select the Lab Reporting folder to open it.

4. Next we’ll create a folder to contain our data sources. A data source can be created at any level in

Reporting Services. As a best practice we will keep the data sources separate from reports. Select New

Folder.

5. Name the folder Data Sources and select Ok.

6. Select the Data Sources folder to open it.

7. Select New Data Source.

8. Name the new data source LabReporting_RACEDEMO.

9. Under Data Source type, select the drop down to see the available data source types. In this lab we will be

connection to an existing SQL database, so leave the data source type set to Microsoft SQL Server.

10. Connection strings are the test representation of connection properties for a data provider. Every provider

will have different required connection strings. When you connect to a SQL Server database, you are

connecting to the database object in an instance of SQL Server on a server. The database might have

multiple schemas that have multiple tables, views, and stored procedures. You specify the database object

to use in the query designer. If you do not specify a database in the connection string, you connect to the

default database that the database administrator assigned to you.

We are connecting to a demonstration SQL Server database for our lab. Enter the following string in the

Connection String textbox:

Data Source=w2k8-ftvp1;Initial Catalog=RACEDemo

Note that w2k8-ftvp1 is the name of our server and RACEDemo is the name of the SQL database that we

are connecting to.

Page 11: TF07 Leveraging SQL Server Reporting Services (SSRS)

11 of 83

11. Select Windows integrated security.

Credentials are required to run queries, to preview the report locally, and to preview the report from the

report server. After you publish your report, you may need to change the credentials for the data source so

that when the report runs on the report server the permissions to retrieve the data are valid. Additional

security information will be discussed later in this lab.

12. Select the Test Connection button. After receiving a Connection created successfully message, select OK.

Page 12: TF07 Leveraging SQL Server Reporting Services (SSRS)

12 of 83

Creating a Shared Dataset

A dataset is the metadata that represents the underlying data on a specific data source. A Reporting Services dataset contains a

data source definition, a query of the data source and a resulting fields list, and possibly parameters, calculated fields, and

collation and other character sensitivity information to be used by a report.

A report can contain multiple datasets. These datasets can be used by different data regions on the report, or they can be used

to provide dynamic lists of parameters. You can use filtering, sorting, and grouping to change the data shown in the report.

There are two types of datasets:

Shared dataset: A shared dataset is defined on the report server. You can browse to the server to create a shared

dataset or to select a predefined one to add to your report.

Embedded dataset: An embedded dataset is defined in and used by only the report it is embedded in.

In this exercise we are going to create a shared dataset that will be used for all reporting content

1. Navigate to Home > Lab Reporting.

2. We will create a folder to contain our shared datasets. Note that a dataset can be created at any level in

Reporting Services. As a best practice we will keep the shared datasets separate from reports. Select New

Folder.

3. Name the folder Datasets and select OK.

4. Select the Datasets folder to open it

5. Select Report Builder.

Page 13: TF07 Leveraging SQL Server Reporting Services (SSRS)

13 of 83

Microsoft SQL Server Reporting Services Report Builder is a report authoring tool that features a Microsoft

Office-like authoring environment. When you design a report, you specify where to get the data, which data

to get, and how to display the data. When you run the report, the report processor takes all the information

you have specified, retrieves the data, and combines it with the report layout to generate the report. You can

preview your reports in Report Builder, or you can publish your report to a report server, or a report server in

SharePoint integrated mode, where others can run it.

6. Select New Dataset.

7. You’ll see that Report Manager lists a shared dataset that has been used previously to create sample

content. We want to use the dataset that we just created instead. Select Browse other data sources…

8. Browse to Lab Reporting > Data Sources. Select the LabReporting_RACEDEMO data source and click

Open.

9. Make sure LabReporting_RACEDEMO is selected and click Create.

Page 14: TF07 Leveraging SQL Server Reporting Services (SSRS)

14 of 83

10. Expand the Tables folder to see the list of tables available in the RACEDemo database. Select the

checkbox next to the demoSAGProductionLoss table.

Each dataset in a report contains a collection of fields. Typically, the fields refer to columns or fields returned

by the query in the dataset. For an XML data source, the fields refer to values from XML element nodes and

their attributes. Fields that refer to database fields contain a pointer to the database field and a name

property. You can use the name property to provide a friendly name in place of the name of the database

field. In addition to database fields, the fields list can contain calculated fields. Calculated fields contain a

name and an expression. The expression can be as simple as a concatenation of two database fields (for

example, first name and last name), or it can be used to perform complex calculations.

11. Select Run Query to see the returned dataset.

Page 15: TF07 Leveraging SQL Server Reporting Services (SSRS)

15 of 83

12. We now have a simple data set that returns all data in the production loss table. Some advanced options

like adding calculated tags for the dataset will be performed in later labs. Select the Save icon.

13. Browse to Lab Reporting > DataSets. Name the dataset ProductionLoss and select OK.

14. Exit Report Builder by selecting the Report Builder icon > Exit Report Builder.

Page 16: TF07 Leveraging SQL Server Reporting Services (SSRS)

16 of 83

15. Refresh the browser to see the ProductionLoss dataset under Lab Reporting > Datasets.

Creating a Table Report

In this lab section we will be creating a simple table to view our production loss data.

1. Navigate to Home > Lab Reporting.

2. Select Report Builder.

3. While there are some wizards to assist with creating reports, we are going to manually create a new report.

Select Blank Report.

Page 17: TF07 Leveraging SQL Server Reporting Services (SSRS)

17 of 83

4. The first task we need to perform is to connect to the dataset that we just created. Right-click on Datasets

and select Add Dataset.

5. Select the Browse button to choose a shared dataset.

6. Browse to Lab Reporting > Datasets. Select ProductionLoss and then Open.

7. Change the name of the dataset reference in the report to ProductionLoss. The internal reference from

this report to the shared dataset could have been named anything, but it is a good practice to keep the

names the same.

Note that we were not asked to choose a data source for the report. This is because the ProductionLoss

shared dataset that we created in the previous lab section already has the connection defined to our shared

data source. Had we not created the shared data source and dataset, we could have created them inside

this report. The data source and dataset would then only have been accessible within this report.

Page 18: TF07 Leveraging SQL Server Reporting Services (SSRS)

18 of 83

8. Select Fields.

Report Builder has test run the query and automatically generated a list of fields from the query results when

we created the shared dataset.

9. Select OK.

10. Report Manager has already added a place for the report title (a text box) and a report footer containing a

field with the time that the report was generated. We will be editing the report layout later in this exercise.

Expand the report so that it is wider to accommodate the number of columns from our ProductionLoss

dataset. The report length will automatically expand to accommodate the number of rows in the table.

Page 19: TF07 Leveraging SQL Server Reporting Services (SSRS)

19 of 83

11. Right-click on the report and select Insert > Table. Move the table to the upper left corner under the title.

If an object inside the table is selected, to move the table you need to select the entire object. To do this,

click on the square at the upper-left side of the table.

12. Select the cell located in the first column, second row of the grid. Click on the small table icon in the

upper-left corner of the cell to see the list of available fields from the ProductionLoss dataset.

13. Select Field.

Note that the Title “Field” is automatically applied to the header for the column. The column name can be

changed by clicking on it and typing in a new name.

Page 20: TF07 Leveraging SQL Server Reporting Services (SSRS)

20 of 83

14. Follow the same procedure to add the remaining fields from the ProductionLoss dataset to the table. You

will need to manually add new columns to the table for the additional fields. To add new columns, right-click

on the furthest right column and select Insert Column > Right.

When completed, the following columns should be present:

15. We can immediately preview the data in our table. Select Run from the menu to see a preview of the

report.

16. The result is a raw grid of data. Before we spend time formatting the report, we’d like to add information for

the number of barrels lost and total downtime cost to our report. These values can be calculated based on

the information already in our dataset so we will add calculated fields to our dataset. Select Design to

return to the report editor.

Page 21: TF07 Leveraging SQL Server Reporting Services (SSRS)

21 of 83

17. Right-click on the ProductionLoss dataset and select Add Calculated Field.

18. Name the new field Barrels and then select the fx button to modify the calculated expression for the field.

The Expression dialog box is used to write Microsoft Visual Basic expressions for report item properties.

You can use expressions to set many properties, including color, font, and borders. At run time, the report

processor evaluates expressions and substitutes the result for the value of the property.

The Expression dialog box includes a code window, category tree, category items, description pane, and

example pane. The Expression dialog box is context-sensitive; the category items and descriptions change

in response to the expression category you are working with.

19. To get the total number of barrels, we need to multiply the volume in the table by a constant. Select Fields

(ProductionLoss). Double-click on VolumeM3 to add the value to the expression.

Page 22: TF07 Leveraging SQL Server Reporting Services (SSRS)

22 of 83

20. After the field expression, add the text *8.3864 and select OK.

21. Select OK to close the dataset properties dialog.

22. Next we’re going to add a calculated field for total downtime cost. Right-click on the ProductionLoss dataset

and select Add Calculated Field

23. Name the new field DowntimeCost and then select the fx button to modify the calculated expression for the

field.

24. Set the expression up to multiply the Barrels and OilCost fields. Select OK when finished.

25. Select OK to close the dataset properties dialog.

26. Now we need to add the new fields to the table. Right-click on the Volume M3 column and select Insert

Column > Right.

Page 23: TF07 Leveraging SQL Server Reporting Services (SSRS)

23 of 83

27. Add the Barrels field to the new column. Note that you may receive an error the first time you attempt to

add the Barrels column to the table. This is due to the fact that the table may not have refreshed its

connection to the dataset. If you receive the error, select OK, right-click on the ProductionLoss dataset and

select Dataset Properties. Close the dataset properties and then try to add the Barrels column again.

28. Follow the same procedure to add the DowntimeCost field to the right of the Oil Cost column.

29. Select Run to preview the calculated results for Barrels and Downtime Cost. Select Design to return to the

report editor when finished.

Note that the addition of the Barrels and Downtime Cost was made to the report dataset reference and not

the dataset itself. If we had thought we would be using the calculated fields in other reports we would have

needed to edit the original shared dataset we created.

30. You may have noticed that the calculated results show a large number of decimal places. We can adjust

how these are displayed in the report. Right-click on the Barrels field cell and select Text Box Properties.

31. Select Number.

Page 24: TF07 Leveraging SQL Server Reporting Services (SSRS)

24 of 83

32. Change the category to Number. The default setting for a number type is two decimal places. That will

work for our report so select OK.

33. Follow the same steps to change the format for the DowntimeCost field to Currency (Select Number and

then Currency for the category).

34. Follow the same steps to change the format for the OilCost field to Currency.

35. Run the report.

Notice that while we can now see that the Downtime Cost column is in currency format, the Oil Cost column

did not auto format. This is due to the fact that the Oil Cost column is a text data type in the SQL database

rather than numeric. We can configure the OilCost field to convert to a numeric data type in our table.

36. Return to Design mode.

37. Right-click on the OilCost field and select Text Box Properties.

38. Select the fx button next to the Value field.

39. Change the expression to the following:

=Val(Fields!OilCost.Value)

This will convert the OilCost field to a numeric value.

Page 25: TF07 Leveraging SQL Server Reporting Services (SSRS)

25 of 83

40. Select OK to close the expression editor.

41. Select OK to close the Text Box Properties.

42. Run the report again to see that OilCost has now been properly converted to currency.

43. Return to Design mode.

44. The duration value was shown in seconds. With vary large durations, it may be difficult to interpret the

value. We can format the duration value field to make it easier to read. Right-Click on the DurationSec field

and select Text Box Properties.

45. Select the fx button next to Value.

46. Change the expression to the following:

=int(Fields!DurationSec.Value/3600) & ":" &

int((Fields!DurationSec.Value Mod 3600)/60) & ":" &

(Fields!DurationSec.Value Mod 3600) Mod 60

This expression will format the value into an hh:mm:ss format.

47. Select OK to close the Expression editor.

48. Select OK to close the Text Box Properties.

Page 26: TF07 Leveraging SQL Server Reporting Services (SSRS)

26 of 83

49. Change the Duration Sec column heading to Duration hh:mm:ss (with an Enter after Duration so that

hh:mm:ss is on the second line). Expand the height of the header row so that the full column names are

visible.

50. Highlight the entire header row and select Bold for the font.

51. Select the first two rows in the table and select center for the justification.

52. The next item we want to configure is the report header. Information in the report header will be repeated

on every report page in the case that our report spans multiple pages. Right-click on the report and select

Insert > Page Header.

Drag the text box containing the Title to the report header so that it is displayed on every page of the report.

Page 27: TF07 Leveraging SQL Server Reporting Services (SSRS)

27 of 83

53. We could type in a static report name, but let’s add the report title field instead. This way if someone

decides to rename the report they don’t need to modify the report itself. Click in the title area (where it says

“Click to add title”). Right-click in the title area and select Create Placeholder.

54. Select the fx button next to Value.

55. Select Built-in Fields and double-click ReportName to add it to the expression. Select OK when finished.

56. Select OK to close the placeholder properties.

57. Adjust the size and position of the header, footer, and reporting objects so that the report looks like similar

to the following screenshot:

Page 28: TF07 Leveraging SQL Server Reporting Services (SSRS)

28 of 83

58. We’ve adjusted simple properties, but many additional properties of SSRS reports can be adjusted by

directly editing the object properties. Additionally, many properties can be controlled using complex

expressions. To see a list of available properties, select View from the Report Builder menu.

59. Select the Properties checkbox. This will display the Properties panel on the right side of the Report

Builder editor.

60. Highlight the header row in the table.

61. In the Properties panel, select the dropdown next to BackgroundColor (under Fill) and select Light Steel

Blue.

62. Highlight the row containing the dataset fields.

Page 29: TF07 Leveraging SQL Server Reporting Services (SSRS)

29 of 83

63. In the Properties panel, select the dropdown next to BackgroundColor (under Fill) and select Expression.

64. Enter the following expression:

=IIF(RowNumber(Nothing) Mod 2, “#f5f5f5”,”White”)

This expression will cause the rows in the table to alternate between light gray and white. The expression

editor should look like the following screenshot:

65. Select OK to exit the expression editor.

Page 30: TF07 Leveraging SQL Server Reporting Services (SSRS)

30 of 83

66. The last modification we will make is to change the way the reporting data is sorted. Below the report

editing area, under Row Groups select the drop down next to the (Details) Row Group. Select Group

Properties.

67. Select Sorting.

68. Select Add.

69. Select the StartTime column.

70. Select OK to close Group Properties.

71. Save the report by selecting the Report Builder icon > Save.

Page 31: TF07 Leveraging SQL Server Reporting Services (SSRS)

31 of 83

72. Browse to Lab Reporting.

73. Name the report Downtime Cost Report and select Save.

74. Run the report to ensure that there are no errors (you will need to reselect the Home tab to see the Run

option).

75. Close Report Builder.

76. Refresh the Home > Lab Reporting view to see the newly created report.

77. View the completed report by selecting the Downtime Cost Report.

Page 32: TF07 Leveraging SQL Server Reporting Services (SSRS)

32 of 83

Note that the report likely spans multiple pages. Pages can be reached by using the page navigation

buttons at the top of the report.

Adding Row Grouping and Summary Information

We now have a report that displays downtime data. However, it is hard to analyze the data as is. One way to make the report

more usable is to add grouping and summary information to our table.

In a data region, you can group data by a single field, or create more complex expressions that identify the data on which to

group. Complex expressions include references to multiple fields or parameters, conditional statements, or custom code.

Summary totals can be added to a table for a group or for the entire data region. By default, a total is the sum of the numeric,

non-null data in a group or in the data region, after filters are applied.

In this exercise we are going to setup field grouping and summaries for the Field, WellPad, and WellPair columns in our table.

1. Navigate to Home > Lab Reporting.

2. Select the drop down next to the Downtime Cost Report and select Edit in Report Builder.

3. Under Row Groups (beneath the reporting area), select the dropdown next to the Details group and select

Add Group > Parent Group.

Page 33: TF07 Leveraging SQL Server Reporting Services (SSRS)

33 of 83

4. Select Field for Group by and the checkbox for Add group header. The group header is where we will

place the summary information for the group. Select OK.

You will see that an additional Field column has been added as the left most column in the table for the

grouping we just added.

5. Under Row Groups, select the dropdown next to the Details group again and select Add Group > Parent

Group.

6. Select WellPad for Group by and the checkbox for Add group header. Select OK.

7. Follow the same procedure to add a grouping for WellPair as a parent group for Details.

Page 34: TF07 Leveraging SQL Server Reporting Services (SSRS)

34 of 83

8. We don’t want an additional copy of our grouped columns to show up in the report, so delete the second set

of columns by highlighting them, right-clicking and selecting Delete Columns.

Running the report will show that the data has now been grouped by Field, Well Pad, and Well Pair.

9. Next we will make our groupings expandable. Select the dropdown next to Details under Row Groups and

select Group Properties.

Page 35: TF07 Leveraging SQL Server Reporting Services (SSRS)

35 of 83

10. Select Visibility.

11. Select Hide when the report is initially run. This option will cause the group to be collapsed when the report

is ran.

12. Select the checkbox next to Display can be toggled by this report item.

13. Select WellPair1 from the dropdown. This will allow the information that is not part of the grouping columns

to be maximized or minimized. Note that the column is named WellPair1 since there was already a WellPair

column when we added the group.

14. Select OK to close the group properties.

Running the report will show that the WellPair group now controls the visibility of the detail information. .

15. Select the dropdown next to the WellPair group and select Group Properties.

16. In Visibility, set Hide when the report is initially run and configure the group to toggle based on WellPad1.

Page 36: TF07 Leveraging SQL Server Reporting Services (SSRS)

36 of 83

17. Configure the Group Properties of the WellPad group to Show when the report is initially run and toggle

based on Field1.

18. Run the report to see the final grouping results.

19. Return to Design mode and Save the report.

20. Now we’re going to add some summary information to our report. Select the dropdown next to the Details

group under Row Groups and select Add Total > Before.

Page 37: TF07 Leveraging SQL Server Reporting Services (SSRS)

37 of 83

Report Builder will automatically summarize the columns that it’s capable of summarizing.

21. Following the same procedure, add totals before the WellPair and WellPad groups.

22. Select all of the summary columns by clicking on the cell under the Duration column heading and dragging

to the cell above the DowntimeCost field. Change the cell formatting to red and bold.

23. Delete the Total text above the WellPad and WellPair fields. When finished your report should look like the

following screenshot:

You may have noticed that the summary information was not added for the Duration column. This is due to

the fact that we added a custom value for that column. We will add custom summary values in the next

steps.

Page 38: TF07 Leveraging SQL Server Reporting Services (SSRS)

38 of 83

24. Right-click on the WellPair group cell for Duration Sec and select Text Box Properties.

25. Select the fx button next to value.

26. Add the following expression:

=int(Sum(Fields!DurationSec.Value)/3600) & ":" &

int((Sum(Fields!DurationSec.Value) Mod 3600)/60) & ":" &

(Sum(Fields!DurationSec.Value) Mod 3600) Mod 60

This expression is the same format as the expression used in the previous lab exercise to format the

duration into an hh:mm:ss format. The only difference is that we replaced the DurationSec value with the

Summary of DurationSec values.

27. Select OK to close the expression editor.

28. Select OK to close the Text Box Properties.

29. Follow the same procedure to add the formula from Step 26 to the Duration summary cells for the WellPad

and Field Groups. The expression does not need to be modified since the report will automatically

summarize the entire group when the Sum function is used.

Page 39: TF07 Leveraging SQL Server Reporting Services (SSRS)

39 of 83

30. Oil Cost was not automatically totalized even though it appears to be a number. As previously discussed,

Oil Cost is a text column in the database. In order to perform a calculation at the group level on the Oil Cost

we will need to convert the OilCost field to a value as we did in the previous exercise. Also, it would make

more sense to display the Oil Cost average rather than a total. Right-click on the Well Pair group cell for Oil

Cost and select Text Box Properties.

31. Select the fx button next to Value.

32. Expand the Common Functions Category and select Aggregate.

33. Double-click on the Avg Item to add it to the expression.

34. Select Conversion.

35. We will use the Val function to convert the text Oil Cost value to a number. Double-click Val to add it to the

expression.

36. Select Fields (ProductionLoss). Double-click OilCost to add it to the expression.

Page 40: TF07 Leveraging SQL Server Reporting Services (SSRS)

40 of 83

37. Add two close parenthesis ) to complete the expression:

38. Select OK to close the expression editor.

39. Select the fx button next to ToolTip.

40. Enter the following expression:

="Oil Cost Average"

This will cause the text Oil Cost Average to appear as a tooltip when a user pauses their mouse on the

average value.

41. Select OK to close the expression editor.

42. Select Number and choose Currency for the category.

43. Select OK to close the Text Box Properties.

Page 41: TF07 Leveraging SQL Server Reporting Services (SSRS)

41 of 83

44. Follow the same procedure in steps 30-43 to add the Average values for the Field and WellPad groups

(The expression will be the same for all three groups just as it was for the Duration summary equation)

45. Run the report to see the results.

46. Return to Design mode.

47. Save the report and Close Report Builder.

Page 42: TF07 Leveraging SQL Server Reporting Services (SSRS)

42 of 83

Report Parameters

We now have a report that displays downtime data. However, we are currently returning all data that has ever been logged to

the SQL table. A more realistic and efficient report would return a subset of that data using parameters. In Report Builder, report

parameters are a built-in feature that you can use to control report data, connect related reports together, and vary report

presentation. The following exercises will walk you through adding simple parameters to the report and modifying the parameter

set to utilize more advanced parameter features.

Creating Report Parameters

In this exercise we will add Date and Downtime code parameters.

1. We need to edit the original dataset to accept the parameter values. Navigate to Home > Lab Reporting >

Datasets.

2. Select the drop down next to the ProductionLoss dataset and select Edit in Report Builder.

3. Select Edit as Text.

Page 43: TF07 Leveraging SQL Server Reporting Services (SSRS)

43 of 83

This is the SQL query that was built for us when we chose the demoSAGDProdcutionLoss table in a

previous exercise.

4. We are going to add filter criteria to the SQL query. Add the following code to the end of the query:

WHERE

demoSAGDProductionLoss.StartTime >= @StartTime

AND

demoSAGDProductionLoss.EndTime <= @EndTime

AND

demoSAGDProductionLoss.DowntimeCode LIKE '%' + @DowntimeCode + '%'

5. When finished the statement should look like the following:

Page 44: TF07 Leveraging SQL Server Reporting Services (SSRS)

44 of 83

6. Select the exclamation mark icon to run the query.

7. Enter the following values for the parameters and select OK:

a. @StartTime: Yesterday’s date. For example 6/10/2013

b. @EndTime: Today’s date. For example 6/11/2013

c. @DowntimeCode: Pump

The results set will be filtered for the parameters entered:

8. Select the Save icon, then close the dataset.

9. Navigate to Home > Lab Reporting.

10. Select the drop down next to the Downtime Cost Report and select Edit in Report Builder.

Page 45: TF07 Leveraging SQL Server Reporting Services (SSRS)

45 of 83

11. Under Datasets, right-click on the ProductionLoss dataset and select Dataset Properties.

12. Select the Refresh Fields button to refresh the changes we’ve made to the ProductionLoss dataset

reference. Note that this will not affect the calculated fields we added to the dataset in the previous

exercise.

13. Select the Parameters tab. You will see that the parameters we created in the last couple of steps have

been imported. We have the option to tie these parameters to a defined report parameter or an expression.

Select OK to close the dataset properties dialog.

Page 46: TF07 Leveraging SQL Server Reporting Services (SSRS)

46 of 83

14. The parameters for the report were automatically created when we selected OK. Expand the Parameters

folder.

If we re-opened the ProductionLoss dataset properties the Parameters section would show that the

Parameters for the dataset were mapped to the newly created report parameters.

15. Next we are going to configure our parameters. Right-click on the StartTime parameter and select

Parameter Properties.

16. Change the Data type to Date/Time.

17. Select Default Values. Select the Specify values option.

18. Select Add and then select the fx button to create an expression.

Page 47: TF07 Leveraging SQL Server Reporting Services (SSRS)

47 of 83

19. Add the expression =dateadd(“h”,-12,Now()). Every time the report is ran the start time will

default to 12 hours ago and then allow users to change the time period.

20. Select OK to close the expression editor and then OK to close the StartTime parameter properties.

21. Right-click on the EndTime parameter and select Parameter Properties.

22. Change the Data type to Date/Time.

23. Select Default Values and choose the option Specify Values.

24. Select Add and then select the fx button to edit the default value.

25. Enter the expression =now(). This will set the report end time to the timestamp when the report is ran.

Select OK to close the expression editor and then OK to close the EndTime parameter properties.

26. Right-click on the DowntimeCode parameter and select Parameter Properties.

27. Select the checkbox next to Allow blank value. Since the SQL query we entered previously was written to

allow you to enter any part of the DowntimeCode string (or none at all), we can allow users to leave the

parameter blank.

28. Select Default Values. Select Specify values.

29. Select Add.

Page 48: TF07 Leveraging SQL Server Reporting Services (SSRS)

48 of 83

30. Delete (Null) from value and leave the Value field blank. Since blank parameters will work with our query,

this configuration will cause the report to automatically generate at runtime with a blank value (effectively

returning all Downtime codes). Select OK to close the parameter properties.

31. Select Run to preview the report.

32. The report data will be displayed for the last 12 hours. Type Part in the Downtime Code parameter.

33. Select View Report. Depending on the dataset generated, there might not be any records for the Replace

Part downtime code in your dataset. If the report comes up blank, try setting the Start time back an extra

day or choosing a different downtime code.

Note that you did not have to enter the entire Downtime Code string. This is due to the way we wrote the

SQL query (the LIKE expression with the % symbols surrounding it will allow users to enter any part of the

parameter name).

34. Return to Design mode.

35. Save the report.

Page 49: TF07 Leveraging SQL Server Reporting Services (SSRS)

49 of 83

Automatically Populating Parameters

In the previous exercise we created a blank parameter field for users to enter the date and downtime code. In order to filter the

downtime code, the user needed to know what the available downtime codes were and manually enter the downtime code string

into a text box. It may have been more useful to have allowed users to select the downtime code from a list. The available

options in the list could have been populated manually by specifying available values (just as we specified a blank value) or they

could be populated using a query. In the next steps we will populate the Downtime Code parameter using a query.

1. We need to create a new dataset for our parameter. We are going to create a dataset in this report since

we don’t think it will need to be reused. First we need to define what data source the new dataset will use.

Right-click on Data Sources and select Add Data Source.

2. Select the shared data source LabReporting_RACEDEMO. Name the data source reference

LabReporting_RACEDEMO and select OK.

3. Next we will create a dataset for the Downtime code parameter. Right-click on Datasets and select Add

Dataset.

Page 50: TF07 Leveraging SQL Server Reporting Services (SSRS)

50 of 83

4. Name the dataset DowntimeCode and select Use a dataset embedded in my report.

5. Select the LabReporting_RACEDEMO dataset reference (which we just created)

6. Enter the following SQL query:

Select Distinct demoSAGDProductionLoss.DowntimeCode

FROM

demoSAGDProductionLoss

ORDER BY

demoSAGDProductionLoss.DowntimeCode

When finished your data source configuration should look like the following screenshot:

7. Select the Refresh Fields button. If the query has been entered correctly there should be no error messages.

Select Fields to see that the query successfully determined the available fields.

8. Select OK to close the dataset properties.

9. We now have to modify the DowntimeCode parameter to display the query results. Right-click on the

DowntimeCode parameter and select Parameter Properties.

Page 51: TF07 Leveraging SQL Server Reporting Services (SSRS)

51 of 83

10. Select Available Values.

11. Choose the option to Get values from a query.

12. For the Dataset, select the DowntimeCode dataset that we created in previous steps. Select

DowntimeCode for the value and label fields. (Our SQL query only returned a single column named

DowntimeCode. Had the query returned more columns we could have chosen which column to use for

these properties)

13. Select Default Values.

14. Choose the option to Get values from a query.

15. For the Dataset, select the DowntimeCode dataset. Select DowntimeCode for the value field.

16. Select OK.

Page 52: TF07 Leveraging SQL Server Reporting Services (SSRS)

52 of 83

17. Select Run.

The report has been filtered to only show the selected Downtime Code. As before, the selected downtime

code may not have data depending on your dataset. To see data either adjust the time period or Select

another Downtime Code from the list and then the View Report button to see the filtered report.

18. Return to Design mode and Save the report.

19. Close Report Builder.

Selecting Multiple Parameters

You may have noticed that when we added the Downtime Code parameters in the previous section we limited the report to only

show data for a single parameter at a time. It may be more useful to allow users to select multiple parameter values. To do this,

we need to modify our dataset to handle the multiple parameter inputs.

1. Navigate to Home > Lab Reporting > Datasets.

2. Select the drop down next to the ProductionLoss dataset and select Edit in Report Builder.

Page 53: TF07 Leveraging SQL Server Reporting Services (SSRS)

53 of 83

3. Modify the last line of code to the following:

demoSAGDProductionLoss.DowntimeCode IN (@DowntimeCode)

This will allow a comma separated list of Downtime Code’s to be entered into the @DowntimeCode

parameter. When finished, the code should look like the following screenshot:

4. Select the exclamation mark icon to run the query.

5. Enter the following values for the parameters and select OK:

a. @StartTime: Yesterday’s date. For example 6/10/2013

b. @EndTime: Today’s date. For example 6/11/2013

c. @DowntimeCode: Pump Stall

The results set will be filtered for the parameters entered:

Page 54: TF07 Leveraging SQL Server Reporting Services (SSRS)

54 of 83

6. Save the dataset.

7. Close Report Builder.

8. Navigate to Home > Lab Reporting.

9. Select the drop down next to the Downtime Cost Report and select Edit in Report Builder.

10. We need to edit our parameter to pass in multiple values. Right-click on the DowntimeCode parameter and

select Parameter Properties.

11. Uncheck Allow blank value.

12. Check Allow multiple values.

13. Select OK to save the parameter properties.

14. Run the report.

15. Multiple Downtime Code values can now be selected. Select several downtime codes and then View

Report to see the output.

16. Return to Design mode and Save the report.

Page 55: TF07 Leveraging SQL Server Reporting Services (SSRS)

55 of 83

Cascading Parameters

In previous exercises you may have noticed that some of the downtime code results had no data in the selected reporting time

range. Cascading parameters provide a way of managing large amounts of report data. With cascading parameters, the list of

values for one parameter depends on the value chosen in preceding parameter. In this exercise we configure the Downtime

Code parameter list to only show downtime codes available within the select reporting time period.

1. First we will edit the DowntimeCode dataset to accept the StartTime and EndTime parameters. Right-click

on the DowntimeCode dataset and select Dataset Properties.

2. Modify the Query to the following:

Select Distinct demoSAGDProductionLoss.DowntimeCode

FROM

demoSAGDProductionLoss

WHERE

StartTime >= @StartTime

AND

EndTime <= @EndTime

ORDER BY

demoSAGDProductionLoss.DowntimeCode

3. Select Refresh Fields.

4. Select Parameters. You will see that we now have a StartTime and EndTime parameter for this dataset.

5. Select the @StartTime and @EndTime parameters from the Parameter Value dropdown lists. This will

configure the DowntimeCode dataset to use the existing time period parameters.

6. Select OK to close dataset properties.

Page 56: TF07 Leveraging SQL Server Reporting Services (SSRS)

56 of 83

7. Run the report. You should see that the list of available downtime codes is smaller than the full set shown

in the list in the previous exercise. Experiment with modifying the Start Time and End Time parameters to

see the Downtime Code list automatically update.

8. When finished with the report, return to Design mode and Save the report.

Page 57: TF07 Leveraging SQL Server Reporting Services (SSRS)

57 of 83

Charts

Charts enable you to present large volumes of aggregated information at a glance. It can more effectively convey information

than lengthy lists of data. Spending time carefully preparing and understanding your data before you create a chart will help you

design your charts quickly and efficiently.

Adding a Pie Chart

In this exercise we will add a Pie chart of downtime codes to our existing Downtime Cost Report.

1. We will add the chart to the top of the report. Start by expanding the report area and moving the objects to

create space for the new chart.

2. Right-click on the reporting area and select Insert > Chart.

Page 58: TF07 Leveraging SQL Server Reporting Services (SSRS)

58 of 83

3. Select the 3-D Pie chart type and then OK.

4. Expand the chart to better fit the area.

5. Select the pie chart data area to see the Chart Data configuration dialog.

Page 59: TF07 Leveraging SQL Server Reporting Services (SSRS)

59 of 83

6. Select the + symbol next to Values and then select the Datasets > ProductionLoss > DowntimeCode field

from the original dataset. This will tell our chart to use all of the DowntimeCode values from the dataset.

7. Next we need to tell the chart what to group by. When we selected the values for the chart it automatically

brought in the Details group. Use the dropdown next to details to change to grouping by DowntimeCode.

8. Delete the chart title.

Page 60: TF07 Leveraging SQL Server Reporting Services (SSRS)

60 of 83

9. Select the outside border of the chart. Right-click and select Chart Properties.

10. Select Sea Green for the Color palette.

11. Select Border and then Sunken for the border type.

12. Select OK to close the Chart Properties.

13. Next we’ll add the percentage values to the pie chart. Right-click on the pie and select Show Data Labels.

Page 61: TF07 Leveraging SQL Server Reporting Services (SSRS)

61 of 83

14. The count of the downtime code occurrences is shown on the pie chart. Rather than show the counts, we’d

rather see the percentage values for each downtime code. Right-click on one of the labels and select

Series Label Properties.

15. Enter #PERCENT{P1} for Label data. {P1} indicates the number of percentage decimal places to show on

the chart.

16. Select OK to close the Series Label Properties. When prompted to set the UseValueAsLabel property to

False select Yes and then select OK to close the Series Label Properties.

17. Right-click on the legend and select Legend Properties.

Page 62: TF07 Leveraging SQL Server Reporting Services (SSRS)

62 of 83

18. Set the Legend Position to middle right.

19. Select Shadow and change the Shadow offset to 2pt.

20. Select OK to close Legend Properties.

21. Run the report. You will now see a pie chart which provides a quick overview of the Downtime Code

frequencies. Changing the parameters will also change the pie chart based on the settings we previously

configured in this report.

22. When finished viewing the report, return to Design mode and Save.

Page 63: TF07 Leveraging SQL Server Reporting Services (SSRS)

63 of 83

Adding Sparklines and Data Bars

Sparklines and data bars are small, simple charts that convey a lot of information in a little space, often inline with text.

Sparklines and data bars are often used in tables and matrices. Their impact comes from viewing many of them together and

being able to quickly compare them one above the other, rather than viewing them singly. They make it easy to see the outliers,

the rows that are not performing like the others. Although they are small, each sparkline often represents multiple data points,

often over time. Data bars can represent multiple data points, but typically illustrate only one. Each sparkline typically presents a

single series. You cannot add a sparkline to a detail group in a table. Because sparklines display aggregated data, they must go

in a cell associated with a group. Sparklines and data bars have the same basic chart elements of categories, series, and values,

but they have no legend, axis lines, labels, or tick marks.

In this exercise we are going to add sparklines and data bars to our existing table in the Downtime Cost Report.

1. Right-click on the Downtime Cost column in the table and select Insert Column > Left.

2. In the last row of the new column, select the DowntimeCost field.

3. Select the two header row cells named Downtime Cost. Right-click on the cells and select Merge Cells.

Page 64: TF07 Leveraging SQL Server Reporting Services (SSRS)

64 of 83

4. Select the Field group cell under the first column of Downtime Cost. Right-click on the cell and select Insert

> Sparkline.

5. Select the first Line type of sparkline and then select OK.

6. Select the Sparkline so that the Chart Data dialog appears.

7. Select the + symbol next to Values and choose DowntimeCost.

Page 65: TF07 Leveraging SQL Server Reporting Services (SSRS)

65 of 83

8. Follow the same procedure to add a sparkline for downtime cost to the WellPad and WellPair groups.

9. Right-click on the cell containing the DowntimeCost field reference under the sparklines and select Insert >

Data Bar.

10. Select the Bar style of data bar and then OK.

Page 66: TF07 Leveraging SQL Server Reporting Services (SSRS)

66 of 83

11. Click to select the data bar so that the Chart Data editor is visible.

The chart data has already been populated since we selected an existing field in the chart. Had we placed

the summary calculation in the table cells where we added sparklines they also would have automatically

populated.

12. Widen the first column of Downtime cost so that it will be easier to see the sparkline results. Expand the pie

chart to fit the new table width.

13. Run the report.

You’ll see that you now have sparklines and databars for the Downtime Cost. While they do not provide

detailed information, they do provide a general sense of how the downtime cost is trending. By using the

databars users can tell with a quick glance which downtime events caused the highest downtime cost.

14. When finished viewing the report, return to Design mode and Save.

Page 67: TF07 Leveraging SQL Server Reporting Services (SSRS)

67 of 83

Drillthrough Reports

A drillthrough report is a report that a user opens by clicking a link within another report. Drillthrough reports commonly contain

details about an item that is contained in an original summary report. The data in the drillthrough report is not retrieved until the

user clicks the link in the main report that opens the drillthrough report.

In this exercise we will create a new report containing a table of Downtime Code occurrences. We will then modify our existing

Downtime Cost Report to drill through to the new report.

1. We are going to use our existing Downtime Cost Report as a template for the new report so that we don’t

have to reconfigure the datasets and parameters. With the Downtime Cost Report open, select the

ReportBuilder icon and then Save As.

2. Browse to Lab Reporting and name the new report Downtime Code History then select Save.

3. Delete the existing pie chart and table objects.

4. Add a new table by right-clicking on the report area and selecting Insert > Table.

Page 68: TF07 Leveraging SQL Server Reporting Services (SSRS)

68 of 83

5. Select the table icon in the cell that is in the first column, second row of the table and select Datasets >

ProductionLoss > StartTime.

6. Follow the same procedure to add the EndTime, DowntimeCode,DurationSec, and DowntimeCost

dataset fields to the table. (You will need to add new columns by right-clicking on the far right column and

selecting Insert Column > Right)

7. Select the first row and change the font to Bold.

8. Select the Details group under Row Groups (beneath the report editing area) and select Add Total >

Before.

Page 69: TF07 Leveraging SQL Server Reporting Services (SSRS)

69 of 83

9. Change the Summary row font to Red and Bold.

10. Change the Text Box properties for the DowntimeCost and Sum(DowntimeCost) cells to a Number style

with Currency as the category. (Right-click on the cells and select Text Box Properties. Select Number

and then Currency)

11. Adjust the reporting objects so that your report looks like the screenshot below:

12. Run the report to see the results.

We now have a simple table that shows Downtime Code history only.

Page 70: TF07 Leveraging SQL Server Reporting Services (SSRS)

70 of 83

13. Return to Design mode and Save the report.

14. Select the Report Builder icon and then Open.

15. Select the Downtime Cost Report and then Open.

16. We are going to modify our original report to allow users to click on any part of the pie chart’s dataset to get

a table history for that downtime code. To add the drill through action to the pie chart, select the pie chart.

Right-click on the pie and select Series Properties.

Page 71: TF07 Leveraging SQL Server Reporting Services (SSRS)

71 of 83

17. Select Action.

18. Change the option for Enable as an action to Go to report.

19. Select Browse next to Specify a report.

20. Select the Downtime Code History report and then Open.

21. Next we are going to specify which parameters should be passed into the Downtime Code History report.

Select the Add button three times to add three parameters.

22. For the first parameter, select StartTime for the Name.

23. Select the fx button next to value.

Page 72: TF07 Leveraging SQL Server Reporting Services (SSRS)

72 of 83

24. We want to pass in the start time that is currently being used for the report. We can add the parameter value

to accomplish this. Select Parameters and double-click the StartTime value to add it to the expression.

25. Select OK to close the expression editor.

26. Follow the same procedure to add the EndTime parameter as the next drill through parameter.

27. For the third parameter, select DowntimeCode for the name.

28. Select the drop-down next to the Value for DowntimeCode and choose the DowntimeCode field from the

dataset. This will cause the downtime code that is being reported in the section of the pie chart that is

clicked to be passed into the Downtime code History report as a parameter.

Page 73: TF07 Leveraging SQL Server Reporting Services (SSRS)

73 of 83

29. Select Series Data. We will add a Tooltip for the chart to make it easier to tell which section we are clicking

on for the drill through.

30. Select the fx button next to Tooltip.

31. Select Fields (ProductionLoss). Double-click on DowntimeCode to add it to the expression.

32. Select OK to close the expression editor.

33. Select OK to close the Series Properties.

34. Save the report.

35. Close Report Builder.

36. Refresh the Lab Reporting page to see the new report.

37. Select the Downtime Cost Report.

38. Move the mouse pointer over one of the slices of the pie chart to see the tooltip for the downtime code

name.

Page 74: TF07 Leveraging SQL Server Reporting Services (SSRS)

74 of 83

39. Click on the pie slice to see the drillthrough report.

The report is automatically filtered for the Start Date and End Date parameters in the Downtime Cost Report

and the downtime code we selected from the pie chart. The parameters are hidden in the drill-through

report but can be expanded and modified by selecting the arrow above the report toolbar.

This completes the exercises for creating SQL Server Reporting Services reporting content. In these exercises we used Report

Manager and Report Builder to create and edit reporting objects. Another choice not covered in this lab for creating and editing

SSRS content is the SQL Server Business Intelligence Development Studio. (BIDS). Business Intelligence Development Studio

is Microsoft Visual Studio with additional project types that are specific to SQL Server business intelligence. For more

information explore the Reporting Services help files and Microsoft content available online

Page 75: TF07 Leveraging SQL Server Reporting Services (SSRS)

75 of 83

Security

SQL Server Reporting Services (SSRS) offers several configurable options for authenticating users and client applications

against the report server. By default, the report server uses Windows Integrated authentication and assumes trusted

relationships where client and network resources are in the same domain or in a trusted domain. Depending on your network

topology and the needs of your organization, you can customize the authentication protocol that is used for Windows Integrated

authentication, use Basic authentication, or use a custom forms-based authentication extension that you provide. Each of the

authentication types can be turned on or off individually. You can enable more than one authentication type if you want the report

server to accept requests of multiple types.

When you start Report Manager, the pages, links, and options that you see will vary based on the permissions you have on the

report server. To perform a task, you must be assigned to a role that includes the task. A user who is assigned to a role that has

full permissions has access to the complete set of application menus and pages available for managing a report server. A user

assigned to a role that has permissions to view and run reports sees only the menus and pages that support those activities.

Each user can have different role assignments for different report servers, or even for the various reports and folders that are

stored on a single report server.

By default, SQL Server Reporting Services is configured to allow anyone in the Local Administrator group access to the website.

In this exercise we are going to modify the security permissions in Report Manager for another user on this image who is not an

Administrator. We will then login as the other user to see the security changes.

1. In Report Builder, browse to the Home page.

2. Select Folder Settings.

3. Select New Role Assignment.

4. For Group or user name enter the user W2K8-FTVP1\SSRSUser. This is the name of a windows user on

this image.

Page 76: TF07 Leveraging SQL Server Reporting Services (SSRS)

76 of 83

5. Select the checkbox next to Browser. This will allow SSRSUser to see the content in Report Manager

without any edit rights.

6. Select OK.

7. Return to the Report Manager Home page.

8. Next we are going to give the SSRSUser additional permissions for the content we created in this lab.

Select the drop-down next to Lab Reporting and select Security.

Page 77: TF07 Leveraging SQL Server Reporting Services (SSRS)

77 of 83

9. Select Edit Item Security. When prompted to apply security settings different from the Home parent item

select OK.

10. Select Edit next to the SSRSUser.

11. Select the checkbox next to Content Manager. This will allow the user to edit items under the Lab

Reporting Folder in Report Manager.

12. Select Apply.

13. The final security item that we’ll modify is access to a specific report. Browse to Home > Lab Reporting.

Select the drop-down next to the Downtime Code History report and select Security.

14. Select Edit Item Security. Select OK when prompted to apply security settings for this item that are

different from the Lab Reporting parent item.

15. Select the checkbox next to W2k8-FTVP1\SSRSUser and then Delete. This will remove access rights for

SSRSUser for this report even though the user has rights to the Lab Reporting parent folder. Select OK

when prompted to delete the security item.

Page 78: TF07 Leveraging SQL Server Reporting Services (SSRS)

78 of 83

16. Before we test the new security settings, we need to configure security for the data source. When we

configured the LabReporting_RACEDEMO data source, we indicated that we wanted to use Windows

Security for authentication. This means that the SSRSUser account will need to have access rights to the

RACEDEMO database. We can make this configuration change in SQL Server Management Studio.

From the Start menu select All Programs > Microsoft SQL Server 2008 R2 > SQL Server Management

Studio.

17. Select Connect to continue with our current Windows credentials.

18. Browse to Security > Logins. Right-click on the exiting login for SSRSUser and select Properties.

19. Select User Mapping.

20. Scroll down to the RACEDemo database and select the checkbox next to it.

Page 79: TF07 Leveraging SQL Server Reporting Services (SSRS)

79 of 83

21. Under Database role membership, select the checkbox next to the db_datareader role. This will give the

user access to only view the data.

22. Select OK.

23. Close Microsoft SQL Server Management Studio.

24. Log off of Windows.

25. Select the SSRSUser. Enter the password rockwell to login.

26. Open Internet Explorer and browse to http://w2k8-ftvp1/Reports.

The Edit buttons that were previously available when we were logged in as an administrator have been

removed from the view for this user.

Page 80: TF07 Leveraging SQL Server Reporting Services (SSRS)

80 of 83

27. Select the dropdown next to FTEnergy and then select Delete. Select OK when prompted to delete.

As expected, we were not allowed to delete the FTEnergy folder since we only have read permissions for

everything except the Lab Reporting folder.

28. Return to the FTEnergy Folder and then select MeterReport. We can still access the reporting content

since we have view permissions.

29. Return to the Home page and select the Lab Reporting folder.

At this level we have options to edit content in Report Manager. However we still do not have permissions

to access Report Builder since we did not select them while editing Security.

We also cannot see the Downtime Code History report since we removed permissions to that report for this

user.

30. Select the Downtime Cost Report.

Page 81: TF07 Leveraging SQL Server Reporting Services (SSRS)

81 of 83

31. Select one of the sections of the pie chart to drill down into the Downtime Code History report.

As expected, we were also not able to view the report the report using drill through due to the security

settings.

This section provided a basic demonstration for configuration of simple security for SQL Server Reporting Services. For

advanced security settings and features, explore the Reporting Services help files and Microsoft content available online.

This completes the lab: Leveraging SQL Server Reporting Services (SSRS)

Page 82: TF07 Leveraging SQL Server Reporting Services (SSRS)

82 of 83

Notes

Page 83: TF07 Leveraging SQL Server Reporting Services (SSRS)

83 of 83

Publication XXXX-XX###X-EN-P — Month Year Copyright© 2013 Rockwell Automation, Inc. All rights reserved.

Supersedes Publication XXXX-XX###X-EN-P — Month Year