Reporting Services
One of the most vital aspects of business intelligence is reporting. Organizations rely on reporting engines to deliver key information in a timely fashion. These engines need to allow users to create and deliver a variety of reports based on customer requirements. SQL Server 2012 Reporting Services (SSRS) provides a complete range of tools and services to meet those customer requirements.
If you’ve designed reports using any version of SSRS, you’ll probably be familiar with some of the topics. However, if you are new to SSRS 2012, we recommend you read the overview of SSRS beginning at http://msdn.microsoft.com/en-us/library/ms159106(v=sql.110).aspx.
What Will You Learn in This Chapter?
By the end of the chapter, you’ll learn about
Software Prerequisites
To get the most out of this chapter, you’ll need the following software:
Introduction to Reporting Services
Reporting Services is a server-based platform that facilitates reporting with ready-to-use tools to author, manage, deploy, and deliver reports using Web or Windows applications. Using Reporting Services, you can retrieve data from various data sources, publish reports, and view or export them in various formats. Reporting Services also includes a central management capability through which you can manage reports and report security.
Reporting Services delivers end-to-end processing and management of reports, with solutions that address a wide range of scenarios. You can take advantage of the out-of-the-box features using built-in tools or write custom code using the API. In this way, the product meets the needs of different audiences—report administrators, report authors, and business users. Although they all essentially share same tools, the Reporting Services API helps developers extend the features and functionality.
Here are some of the key features of Reporting Services:
Now let’s take a look at the Reporting Services architecture.
Architecture
The Reporting Services architecture consists of three major components:
All of these extensions allow users to create custom features in the product. For example, you can create and install a custom rendering extension to support a new output format. Given all these extensions, on a high level the Reporting Services service and component architecture looks like what’s shown in Figure 3-1.
Figure 3-1. Reporting Services service and component architecture
Information about reports, report properties, and objects are stored in a SQL Server database, which also holds report models, published reports, and the folder hierarchy managed by Report Server. This database provides internal storage information for single or multiple report servers. This all arrives as an installation package with SQL Server 2012.
Choosing the Right SSRS Mode
SSRS operates in two modes, native and SharePoint mode. With native mode, Report Server takes the lead and manages all the functions of reporting services. If there is no plan for implementing SharePoint or for integrating with SharePoint, then choosing native mode is appropriate. However, there are significant advantages to using SharePoint mode. Here are some of them.
Reporting Services supports multiple instances of Report Server and you can have both modes running on a single server. However, to integrate with SharePoint, additional configuration steps are needed. And it is also important to understand what changes occur to the infrastructure after installing SSRS and integrating with SharePoint. Since the SharePoint platform provides the necessary infrastructure when you choose SharePoint mode, you no longer have the functions such as Report Manager, Management Studio, My Reports, Linked Reports, and Job Management that are available in native mode. Also, there’s no way to migrate reports deployed in native mode to SharePoint mode. You have to republish them to SharePoint manually.
Installing and setting up SQL Server Reporting Services and SharePoint 2013 is quite easy. Though you can choose to install any edition of SQL Server 2012, in this chapter we will walk you through installing and configuring Enterprise edition for SharePoint mode.
Note To understand the differences in the feature set of various SQL Server 2012 editions, see the Reporting Services Section at http://msdn.microsoft.com/en-us/library/cc645993(v=SQL.110).aspx.
Setting Up the Infrastructure
After you’ve finished the basic steps for installing SQL Server, such as verification, entering the product key, accepting licensing terms, and installing setup support files, you can then choose features as shown in Figure 3-2. If you are installing SQL Server for the first time, you can select Reporting Services, along with Database Engine Services and others features. If SQL Server is already installed and you are setting up Reporting Services now, rerun the SQL Server setup and choose Reporting Services in the Features pane.
Figure 3-2. Choosing SQL Server features to install
In the next several steps, you configure a number of items, including the installation rules, the SQL Server instance, and the service account for the server. When you’ve completed the basic installation, you then go through Database Engine Configuration, Analysis Services Configuration, and Reporting Services Configuration. For Reporting Services Configuration, you can choose among three options as shown in Figure 3-3.
Figure 3-3. Reporting Services configuration modes
Here are the details about the three options you have for on the Reporting Services Configuration screen:
Now that Reporting Services and the Reporting Services Add-in are installed, you can configure your SharePoint environment for Reporting Services by following the article at http://msdn.microsoft.com/en-us/library/jj219068.aspx.
To begin authoring reports, it is important to understand the features offered by the Reporting Services Add-in and to choose the right mode (Local vs. Connected) for your reports. It is more likely that you will use connected mode for enterprise reporting scenarios.
In previous versions of SQL Server, the Reporting Services Add-in was available as a standalone installer. But in SQL Server 2012, this is bundled as part of the standard installation package. Let’s take a look at the features offered by this add-in.
Reporting Services Add-in Features
This add-in brings the collaborative features of SharePoint into the reporting environment. Here are some key features enabled by this add-in:
Reporting Services Local Mode vs. Connected Mode
In the context of SharePoint Server, Reporting Services can run in either connected mode or local mode. Connected mode is the default and includes SharePoint Server, the SSRS add-in, and SQL Server report server. It enables end-to-end reporting, collaboration, and server-based features such as subscriptions. However, after installing the SSRS add-in, you have to configure your SharePoint server.
Local mode was introduced in the SQL 2008 R2 version; it is very lightweight and integrates Reporting Services with SharePoint Server. It consists of SharePoint Server and the SSRS add-in, but it does not require a report server. Because report server is not available, users can view the reports but they have no access to server-side features such as subscriptions. In local mode, reports are rendered locally from a SharePoint document library. In order to run local-mode reporting, you need to enable the ASP.NET session state.
When a user requests a report on the SharePoint site, the report server proxy endpoint creates a session and connects to the report server. It prepares for the processing of the report, and on the report layout it delivers the data and displays it using the Report View Web Part. There are other processing instructions that help in exporting the report in the selected output format and providing drill-down capabilities, delivery on subscription, and so forth.
A key item to note is the SharePoint API. You can program and create custom delivery extensions, extend the data processing, transform data, and create custom rendering extensions. You can also build a custom security extension to support your own authentication needs. Furthermore, you can use the SOAP API to access a report server and the web service programmatically.
Now that you have a good understanding of the Reporting Services infrastructure and the various components involved, it is time to start building your first report. Before authoring your report, you need to consider the entire life cycle of the report.
There are three general steps to consider with any report you want to generate:
To consume data or add it to your reports, you will have to create a connection to a data source. To create a data source connection, you need three elements: a data source type, connection information, and credential information. A data source type is a connection type, such as a Microsoft SQL Server, SharePoint List. Connection information contains details about the name and location of the data source. And credentials with permissions over the data source are required in order to access the data.
Data sources can be either shared or embedded. Shared data sources are necessary when a data source is used often by more than one report. Embedded data sources are part of the report itself and can’t be shared with others. Table 3-1 compares shared and embedded data sources.
Table 3-1. Comparison of Shared and Embedded Data Sources
Shared Data Source | Embedded Data Source |
---|---|
Available on report server or SharePoint site | Defined inside a report |
Can be used by multiple reports | Can be used only by a specific report |
Managed on a report server | Managed on a report server |
Can’t be created with Report Builder 3.0 | Can be created using Report Builder 3.0 |
Required for shared datasets | Not required |
You can author reports with data sources using Report Builder or Report Designer from SQL Server 2012 Data Tools (SSDT). The key difference between the two is that in Report Builder you use the ribbon to insert and configure report items, while in Report Designer you use the SSDT toolbox to perform those tasks. However, both tools generate reports in report definition language (rdl). Table 3-2 compares the tools.
Table 3-2. Comparison of Report Designer and ReportBuilder
SSDT Report Designer | Report Builder 3.0 |
---|---|
Reports authored using SQL Server Data Tools by connecting with various data sources | Does not use SSDT and is a separate application |
Source control system compatible | Though it is not directly compatible, reports can be source-controlled from the application. For instance, you can source-control report files using SharePoint document library versioning. |
Used mostly by advanced users and developers | Used by business users for easy report generation |
Capable of multiple deployments | Not capable of multiple deployments |
Can embed a data source and create shared data sources | Add report models |
Can view RDL file source | Can’t view RDL file source |
Can import reports from an Access database | Can’t import reports from an Access database |
Even a brief glance at the products, as in Table 3-2, suggests that SSDT provides many more features than Report Builder 3.0. To get more details about the features of both, visit http://msdn.microsoft.com/en-us/library/dd207010.aspx. Now, let’s author a basic report using SSDT.
Building and Publishing a Basic Report
When you’re authoring a report and publishing it to your SharePoint environment, it is important to choose the right tool. We will use SSDT Report Designer for the following example and later edit the published report using Report Builder.
PROBLEM CASE
Use SSDT Report Designer to author a report that retrieves data from the Adventure Works DW 2012 cube, and publish the report to a SharePoint environment.
Solution
Figure 3-4. Choose the data source, and set the connection properties
Figure 3-5. Query Designer
As a result of previous step, a Query string will be built for you that is nothing but an MDX query that retrieves data from the Adventure Works cube. You can also use query mode by simply clicking on the Design Mode icon (which toggles between design mode and query mode) from the Query Designer window and write your own MDX query.
Figure 3-6. Designing the table in the Report Wizard
Figure 3-7. Choose Text Box Properties for a specific column field
Your final design-mode window should look like what’s shown in Figure 3-8.
Figure 3-8. SSDT Report Designer design-mode window
Before you deploy this report to your SharePoint environment, you need to adjust some settings on the SSDT project and create some libraries to host the report and data source if it is shared.
Figure 3-9. Adding a new app (folders) in the library
This data connection library and the corresponding folders will be used as placeholders for the data sources, datasets, and report parts you design in the report. These will be used only when you share any data sources, datasets, and report parts in your report. If you don’t share, these libraries will be empty even after deploying the reports. Create one more document library to publish the report itself.
Ok! Your infrastructure is ready. You can now publish your report and its data source to SharePoint.
Listing 3-1. Basic Report Property Page settings
Target Dataset Folder - http://yoursharepointsite/datasets
Target Data Source Folder - http://yoursharepointsite/data%20sources
Target Report Folder - http://yoursharepointsite/report%20library
Target Report Part Folder - http://yoursharepointsite/rs%20data%20connections/report%20parts
Target Server URL – http://yoursharepointsite/
Figure 3-10. Deployment status output window
The deployment uses the target library settings indicated in Listing 3-1, and the report is deployed to Report Library. Return to your SharePoint site, and access the Report Library document library. You should now see the rptInternetSales.rdl file in the Report library. Because the data source is embedded in this example, nothing will be deployed to the dataset or data source folders.
Note If you created a shared data source, it is deployed to the report server’s data connections/data sources library folder.
Figure 3-11. Report rendered in the browser in a SharePoint enviroment
Take a look at the report viewer URL. The URL consists of the Report viewer page and arguments passed to the page that include the relative path of the report, source document library, and the default view option of the report indicating whether to open in the client application or browser:
http://yoursharepointsite/_layouts/15/ReportServer/RSViewerPage.aspx?rv:RelativeReportUrl=/Report%20Library/rptInternetSales.rdl&Source=http%3A%2F%2Fbimain%3A1111%2FReport%2520Library%2FForms%2FAllItems%2Easpx
Now that you know how to construct a URL for a specific report, you can use it to load the report in any web or Windows application. For instance, on a different web page, you can use this URL within an iframe to load the report. As mentioned earlier, you can use Report Builder to edit published reports, as you’ll see in the next section.
Using Report Builder to Edit a Published Report
Now you’ve seen how to author and publish a report using the SSDT Report Designer. You can edit the same published report using Report Builder 3.0:
Figure 3-12. Edit in Report Builder from the ECB menu of the report
Figure 3-13. Opening Report Builder from the Actions menu
Figure 3-14. Launching Report Builder
Figure 3-15. Asking user permission
Figure 3-16. Arrange the chart fields for a report using Report Builder
Figure 3-17. Report Builder 3.0 with the report file loaded
Figure 3-18. Report rendered in the browser using the Reporting Services viewer
Although this report is loaded and rendered using the Reporting Services viewer page, some situations might require you to add the report to a specific custom page instead. In that case, you can load the report to any page using the Report Viewer Web Part, which is available when you install the Reporting Services Add-in to your server. The Report Viewer Web Part provides the same functionalities as the Reporting Services viewer page, such as opening with Report Builder, subscribing to the report, retrieving a report rss feed, and so forth. Let’s see how to load reports using the Report Viewer Web Part.
Loading Reports Using the Report Viewer Web Part
Figure 3-19. SSRS Report Viewer
Figure 3-20. The SSRS Report Viewer with the Internet Sales report loaded
Is there a way to create a new report using Report Builder? Yes! And it’s quite simple, too. When you install Reporting Services in SharePoint integrated mode, you will have Reporting Services predefined content types automatically enabled on the site. Let’s see what different content types are available and how to use them on your SharePoint site.
Reporting Services Content Types
Reporting Services content types are enabled on SharePoint sites that are integrated with Reporting Services, which you can use to manage Report Builder reports (.rdl) and shared data sources (.rsds). You can enable these content types in a library so that you can create new documents of these types.
Before setting up these content types in a library, you will have to verify few things on the site. First, make sure you are a site collection administrator or have full permissions. Second, ensure that the Report Server Integration Feature is Active in the site collection feature of your site. This feature provides the necessary infrastructure, content types, and so forth for the site. This feature should have been activated when you configured your SharePoint site for Reporting Services earlier in this chapter (Figure 3-16).
You’ll find the content types available under Report Server Content Types. Because you already created a Report Library document library earlier, go ahead and enable these content types on it:
In the examples you’ve seen so far, we’ve used an embedded data source, which means the data source is specific to this report only. And as we discussed earlier in this chapter, when you want a data source that can be used in other reports, you need to create a shared data source. The connection information file can be either a report shared data source (.rsds) file or an office data connection (.odc) file that can be hosted in a SharePoint document library. An .rsds file is the same as an .rds file, but it has a different schema. When you create a Report Data Source from a new file in a document library on SharePoint, an .rsds file is created. When you create an .rds file from the SSDT Report Designer and publish it to a SharePoint document library, it will be converted into an .rsds file.
Creating a Report Data Source
To create an .rsds file on your SharePoint site, open the document library where you used the Reporting Services content type earlier.
On the Documents tab of the Library Tools tab, click on Report Data Source on the New Document menu. In the Data Source Properties window, follow these steps:
The new data source can be accessed via a URL. Whenever you create a shared data source using SSDT Report Designer or Report Builder, you can enter the shared data source’s URL to access it. To know if there are any dependent items using this shared data source, you can click View Dependent Items from the ECB menu of the shared data source item in the document library. You can certainly edit or delete this shared data source, but be aware that will impact the reports using it.
Now, what if someone wants to subscribe to these reports and knows how the data is changing over a course of time? Or maybe you want to save these reports in a particular output format on a scheduled basis? Reporting Services provides a mechanism to fetch these reports either on-demand or on a subscription basis. In the next section, you’ll see how to subscribe to reports that are published to a SharePoint environment.
Subscription to Reports
When you publish reports to a SharePoint environment integrated with a report server, you have the option to subscribe to them as long as you have access to the reports. You can create subscriptions that can be delivered as follows:
Note Data-driven subscriptions are used when you want to customize the distribution based on dynamic subscriber data at run time. For instance, you can distribute a report in any format either as is or filter data within your organization where subscriber lists vary over time. To learn more about data-driven subscriptions, go to msdn.microsoft.com/en-us/library/ms169673.aspx.
Reports are delivered in one of the available formats you choose while subscribing, including xml, csv, tiff, pdf, mhtml, Excel, and Word. For best results, it is recommended that you export reports in preview mode to see if they emerge correctly. If not, you can change them in design mode to make them look better.
An important aspect to note here is that reports delivered by subscription are not the original report files (.rdl). They are static reports, and you can’t use them with the Report Viewer Web Part. Even if you change the extension back to .rdl, you will not be successful in loading them.
Note When versioning is enabled, only the major version will be created for the rendered output documents.
In the following example, let’s try to subscribe to the Internet Sales report and deliver it to a SharePoint document library in the web archive file format (.mhtml).
PROBLEM CASE
Subscribe to a published Internet Sales Report, and have the report delivered to the document library in the web archive file format.
Solution
Figure 3-21. Add subscription to report
Because credentials used to run the report are not stored and are embedded on the report, you will not be able to create a subscription. Also, you’ll see an error message, as shown in Figure 3-22.
Figure 3-22. Error resulting from trying to add a subscription to a report
Figure 3-23. Manage report data source connection credentials
Note To run Schedules, make sure that SQL Server Agent (MSSQLSERVER) is running.
Figure 3-24. Manage subscriptions to a report
Figure 3-25. Subscription report saved to Report Library
You can click and download the document to your local system and open it to view it. However, you will notice that the drill-down capabilities don’t work when you open these reports. This is one of the limitations of the delivered reports. To overcome this issue, you need to subscribe for e-mail delivery, which will contain a hyperlink to the generated report.
Tip Visit msdn.microsoft.com/en-us/library/bb283186.aspx to learn how to create a subscription for report-server e-mail delivery.
You can view a complete list of available data connection types when creating a new data source or a report, as Figure 3-26 shows.
Figure 3-26. Data connection types available for a report
In the previous example, you saw how to use SQL Server Analysis Services as your data connection type. Authoring a report using a SharePoint list as a data source and publishing it to a SharePoint document library is similar. In the latter case, of course, you retrieve data from a SharePoint list.
Integration with a SharePoint List
For this example, let’s use the Airport Flight Stats custom list you created in Chapter 2. We will also author a new report using the same Report Project Sample you created using SSDT earlier in this chapter.
PROBLEM CASE
Author and publish a report using the Airport Flight Stats custom list.
Solution
Figure 3-27. SSDT Report Designer Query Designer
Figure 3-28. Authoring a report using SharePoint List data
Figure 3-29. View a report authored using SharePoint List data
Power View is a Silverlight-based web client for ad-hoc data analysis and interactive data visualizatons. It is part of the SQL Server 2012 Reporting Services Add-in and runs within SharePoint. This feature is available only within a SharePoint Reporting Services native mode installation and will not be able to run Power View reports.
Until recently, Power View could work only with Analysis Services Tabular models. Power View internally sends DAX queries to the back-end model, gets the required results, and renders them in the view. The traditional SSAS cubes (Multidimensional cubes) used to accept only MDX queries, not DAX Queries. Microsoft recently added DAX support for Multidimensional cubes. You will be able to use Power View with Multidimensional models now. More details on this can be found at http://blogs.msdn.com/b/analysisservices/archive/2013/05/31/power-view-connectivity-for-multidimensional-models-released.aspx.
There are good reasons to use Power View for data visualization compared to other data visualization tools such as Excel and Performance Point Services:
Note Power View needs the Silverlight add-in to be installed on users’ machines to be able to author or view reports.
Creating a Power View Report
Bulding an interactive Power View report is quick and easy. Unlike a traditional SSRS report, fully functional Power View reports can be built right within the browser. SQL Server Data Tools is not required for building Power View Reports. Let’s build our first Power View report now.
PROBLEM CASE
Create a Power View report from Adventure Works Tabular Model.
Solution
Figure 3-30. Creating a new Data Connection for Power View
Figure 3-31. Configuring the data connection for Power View
Figure 3-32. Invoking the Power View report designer from SharePoint
Figure 3-33. Adding Internet Toal Sales Amount to Power View
Figure 3-34. Creating a bar chart with Power View
Figure 3-35. Creating a line chart with Power View
Interacting with Power View Reports
Once the Power View report is saved into a document library, users can open this report and explore the data in it. Power users can edit the report, change the layout of the report, and save it into the document library with the same name or a different one.
PROBLEM CASE
Let’s look at how you can interact with the Power View report in the View mode.
Solution
Figure 3-36. Opening a Power View report from a SharePoint library
Figure 3-37. Exploring the Power View cross-filtering feature
Figure 3-38. View additional details of data bars
Figure 3-39. Filter numeric values using sliders
You can also export the contents of the Power View dashboard into PowerPoint and interact with charts within PowerPoint.
Figure 3-40. Switching to the Edit mode for a Power View report
Figure 3-41. The Export to PowerPoint option
Note The exported PowerPoint file supports interactivity with the charts/tables only if you have a connection available to the SharePoint server.
Summary
As Figure 3-42 highlights, in this chapter you learned about the following:
Figure 3-42. Reporting Services road map
What’s Next?
In the next chapter, you will learn about Business Connectivity Services (BCS) and the improvements in the latest version. We will walk you through setting up BCS, the tools, and external content types (ECT). You will learn how to create an ECT using both SharePoint Designer and.NET Connector. And finally, you will learn about the Business Data Catalog (BDC) runtime and integration with Office applications such as Word and the SharePoint workspace.
1 You can use any document library template as well.