Presentation is loading. Please wait.

Presentation is loading. Please wait.

Event Title Event Date. Module 04—Introduction to SQL Server Reporting Services Name Title Microsoft Corporation.

Similar presentations


Presentation on theme: "Event Title Event Date. Module 04—Introduction to SQL Server Reporting Services Name Title Microsoft Corporation."— Presentation transcript:

1 Event Title Event Date

2

3 Module 04—Introduction to SQL Server Reporting Services Name Title Microsoft Corporation

4 Disclaimer The information contained in this slide deck represents the current view of Microsoft Corporation on the issues discussed as of the Mar- 2008 of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the Mar- 2008 of publication. This slide deck is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS DOCUMENT. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this slide deck may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation. Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this slide deck. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this slide deck does not give you any license to these patents, trademarks, copyrights, or other intellectual property. Unless otherwise noted, the example companies, organizations, products, domain names, e-mail addresses, logos, people, places and events depicted herein are fictitious, and no association with any real company, organization, product, domain name, email address, logo, person, place or event is intended or should be inferred. © 2008 Microsoft Corporation. All rights reserved. Microsoft, SQL Server, Office System, Visual Studio, SharePoint Server, Office PerformancePoint Server,.NET Framework, ProClarity Desktop Professional are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. The names of actual companies and products mentioned herein may be the trademarks of their respective owners. 4

5 Where Are We? Data Sources Staging Area Manual Cleansing Data Marts Data Warehouse Client Access 5

6 Module Overview Reporting Fundamentals Introducing SSRS Basic SSRS Report Design Introducing Report Interactivity Extending Reports with Custom Logic 6

7 Reporting Fundamentals Business Solutions Traditional Reporting Challenges SQL Server 2008 Reporting Services 7

8 Business Solutions Internal reporting within an organization −Operational reporting −Management reporting External reporting −Business-to-business reporting via an extranet Embedded reporting −Portals −Windows and Web applications 8

9 Traditional Reporting Challenges Expensive and complex server-side solutions Proprietary report formats Limits to scalability Difficulties −Integrating with internal applications −Embedding in line-of-business applications −Automating delivery to a large internal or external audience −Extending with additional features 9

10 SQL Server 2008 Reporting Services Delivers enterprise, Web-enabled reporting functionality Queries a wide variety of data sources Publishes reports in various formats Supports pull- or push-driven report delivery Manages security on content and tasks centrally Scales to support thousands of users Enables extensions to core functionality Delivers ad hoc reporting capabilities 10

11 Introducing SSRS Architecture Components The Reporting Life Cycle Customization Options Deployment Scenarios 11

12 Architecture: Native Mode Report Sources Delivery Channels Security Services Output Formats Report Server Data Processing Rendering Security Delivery Report Processing Programmatic Interfaces: XML Web Service and URL Access Report Manager Report Viewer Microsoft Office Microsoft Office Custom Applications Custom Applications Report Server Databases Browser Model Designer Report Builder Report Builder – Query generation Drill-through Report generation Report Designer 12

13 Architecture: SharePoint Integrated Mode Programmatic Interfaces: XML Web Service and URL Access Report Manager Report Viewer Microsoft Office Microsoft Office Custom Applications Custom Applications Browser Model Designer Report Builder Report Designer 13 Report Sources Output Formats Report Server Data Processing Rendering Security Delivery Report Processing Report Server Databases Report Builder – Query generation Drill-through Report generation SharePoint SharePoint Content Database Collaboration Document Mgmt Report Server Proxy Endpoint Config Database

14 Components: Report Server Implemented as an ASP.NET Web service Accessed by administrators to manage content by using −Report Manager or SQL Server Management Studio −RSS scripts or programmatic interfaces embedded in applications Accessed by users to render reports by using −URL access in Report Manager or embedded in portals −Programmatic interfaces embedded in applications 14

15 Components: Report Manager Implemented as an ASP.NET Web application Launched by administrators to configure −Report Server properties −Report execution properties −Security Launched by users to −Explore and view reports −Subscribe to report delivery −Launch Report Builder 15

16 Components: Miscellaneous Report Builder −Delivers online ad hoc reporting functionality Report Builder 2.0 −Delivers ad hoc reporting functionality using an Office- like interface −Supports more advanced report design than Report Builder Report Designer −Enables the design of interactive, complex reports Model Designer −Supports the development and deployment of report models used in Report Builder Report Server Command-Prompt Utilities −Includes configuration utilities −Includes the RS script host to perform scripted operations 16

17 The Reporting Life Cycle Authoring Reports Managing Reports Delivering Reports 17

18 Authoring Reports Data access to a variety of sources −SQL Server / Analysis Services / OLE DB / ODBC / XML / Oracle −SSIS −Report models Report Definition Language (RDL) −Query definitions −Table / Matrix / List / Chart data regions −Interactive features −Expressions Report authoring options −Report Designer (or third party) −Report Builder 2.0 −Report Builder for ad hoc reporting on SQL Server or Analysis Services 18

19 Report Definition Language Report definition −Data retrieval −Structure and position of report items −Appearance and behavior properties RDL is an XML representation of report definition Open and publicly documented schema used to: −Programmatically generate reports −Extend RDL with additional attributes and elements 19

20 Managing Reports Central Report Server and database Web service architecture Managed report execution −On-demand −Scheduled −Multi-user shared cache −Historical snapshots Scalable Role-based security model Report Manager and Object Explorer 20

21 Delivering Reports Runtime report rendering −Excel / CSV / XML / HTML / MHTML / PDF / TIFF / Word Pull delivery −Report requests by user −Report Manager / SharePoint Web parts Push delivery −Report delivery by e-mail or file −Standard subscriptions −Data-driven subscriptions Integration with Microsoft Office Delivery to almost any device 21 Requires Enterprise Edition

22 Customization Options Custom extensions let developers add complementary functionality −Data processing extensions −Delivery extensions −Rendering extensions −Security extensions Custom logic and report items can be added to reports −Custom code −Custom assemblies −Custom report items 22

23 Deployment Scenarios Local Catalog Remote Catalog Scale-out Deployment 23

24 Local Catalog User Report Manager Report Server SMTP Client Report Author Report Designer BI Developer Studio / Report Designer Client Report Server Catalog MSSQL 24 HTTP Listener

25 Remote Catalog User Report Server Catalog SMTP IIS Report Manager Report Server MSSQL User Report Server Catalog SMTP HTTP Listener Report Manager Report Server MSSQL 25

26 Scale-out Deployment User Scale-out - Virtual Report Server MSRS SMTP HTTP Listener Report Manager Report Server Report Server Catalog MSSQL MSRS HTTP Listener Report Manager Report Server Report Server Catalog MSSQL Failover Cluster 26

27 Basic SSRS Report Design Creating a Report Server Project Defining Data Sources Designing Reports 27

28 Creating a Report Server Project Collection of report definitions and resources −RDL files created by using −Report Designer −Report Server Wizard Project −Import Reports utility for Microsoft Access −Shared Data Sources −Image files and other resources (e.g., Word, Excel) Common deployment configuration −Option to overwrite data sources −Target folder for data sources −Target folder for reports −Target Report Server 28

29 Defining Data Sources Data access to a variety of sources −SQL Server / Analysis Services / OLE DB / ODBC / XML / Oracle −SSIS −Report models −Dynamic data source using an expression to set data source at runtime Authentication −Windows integrated security −Specific user credentials −Prompted credentials −No credentials Assignment to reports −Shared with multiple reports −Report-specific 29 Use of shared data sources is considered best practice for manageability reasons

30 Designing Reports Report Designer Dataset Report Controls Expressions 30

31 Report Designer Design −Data −Query definition and configuration −Query execution for testing −Layout −Toolbox for adding data regions and report items −Properties to define position, appearance, and behavior Preview −Preview report without deploying to Report Server −Export report to supported rendering formats −Review print layout of report 31

32 Dataset Represents a query against a data source Contains properties −Name −Data source (Shared or report-specific) −Command type (Text or stored procedure) −Query string −Timeout Defines collections −Fields −Filters −Parameters (for dynamic queries) 32 A report can contain multiple datasets

33 Dataset Query Designers Graphical query designers −SQL Server Transact-SQL −Analysis Services MDX −Analysis Services DMX −Report Models Generic query designer for other data sources Parameterization support in all designers 33

34 Report Controls Data regions −Link to a dataset −Define a specific structure for data −Table −Matrix −List −Chart Report items −Exist independently of datasets −Add supporting details or visual interest −Textbox −Line −Rectangle −Image −Subreport 34

35 Table Data Region Fixed number of columns Dynamic number of rows, dependent on dataset Groups and sorting arrange data within table Entire row or column can be selected for formatting Cells can be merged Table header Table footer Detail row Group header Group footer 35

36 Table Example Table header Detail row Group footer Group header 36

37 Matrix Data Region Dynamic number of columns and rows, depending on dataset Functionality similar to crosstabs or pivot tables Groups can include subtotals Dynamic row group headers Dynamic column group headers Detail cells contain aggregate functions Corner contains static text 37

38 Matrix Example Dynamic row group headers Dynamic column group headers Detail cells contain aggregate functions 38

39 List Data Region Repeats with each group or row in the dataset Supports flexible layout of data −Free-form arrangement of report items −Combination of multiple data regions −Nested data regions Template 39

40 List Example Template 40

41 Chart Data Region Displays a graphical representation of the data Supports a variety of chart types −Column −Line −Bar −Pie −Funnel −Doughnut −Area −Range −Scatter −Bubble −Polar −Radar 41

42 Chart Example Categories Series Title Legend 42

43 Textbox Report Item Contains an expression −Static text −Reference to value of another textbox −Reference to a dataset field −Calculation Uses a variety of formatting properties −Font −Borders −Color and Background color −Padding −Can grow −Visibility 43

44 Line Report Item Use lines to add visual effects to a report −Properties define length, width, color, and so on −Datasets are not associated with lines Use textbox borders to achieve a dynamic effect −Borders expand or contract as textbox size changes −Lines have a fixed size 44

45 Rectangle Report Item Use rectangles to add visual effects to a report −Properties set length, width, color, and so on −Datasets are not associated with lines Use rectangles optionally as a container −Data regions and report items can be placed in a rectangle −Items contained within a rectangle move with it Use report or textbox borders to create an outline −Borders expand or contract as the report or textbox size changes −Rectangles have a fixed size 45

46 Image Report Item Image storage −On the report server −On a web server −Embedded within the report −In a database Image usage −Free-standing logo or picture −Pictures associated with rows of data −Background for certain report items −Body of report −Rectangle −Text box −List −Matrix −Table 46

47 Subreport Report Item Use a subreport to display another report inside the body of a parent report −Any report can be used as a subreport −Parent report passes parameters to the subreport Use a subreport to repeat another report within a data region −A parameter filters data in each instance of the subreport −The host data region’s dataset can be different from the subreport’s dataset 47

48 Expressions Require Microsoft VB.NET Calculate the values… −Of a report item −For style and formatting properties −For many other report item properties (but not size or position) Use functions from a variety of namespaces −Microsoft.VisualBasic −System.Convert −System.Math −Any.NET Framework namespace if explicitly referenced Support references to −Custom code −Other assemblies 48

49 Global Collections Fields −Dataset fields Globals −ExecutionTime −PageNumber −TotalPages −ReportFolder −ReportName −ReportServerUrl Parameters ReportItems User Use standard Visual Basic collection syntax: Collection!ObjectName.Property =Fields!SalesAmount.Value Collection.Item("ObjectName").Property =Fields.Item(“SalesAmount").Value Collection("ObjectName").Property =Fields(“SalesAmount").Value 49 ObjectName references are case-sensitive

50 Aggregate Functions Standard −Sum −Count −CountDistinct −CountRows −Avg −Min and Max −First and Last −StDev and StDevP −Var and VarP Running −RowNumber −RunningValue ScopeExpression Aggregate function 50 Scope Specifies a grouping, dataset, or data region Sets scope of values to be aggregated Optional parameter when used in a data region Required parameter when used in a free-standing textbox =Sum(Fields!SalesAmount.Value, "table1")

51 Expression Editor Simplifies the construction of expressions Provides access to −Global collections −Operators −Common functions Enables dynamic properties 51

52 Expression Examples =Today() =DateAdd(DateInterval.Month, 6, Parameters!StartDate.Value) =Globals!PageNumber & " of " & Globals!TotalPages =Iif(Fields!Profit.Value < 0, "Red", "Black") =Switch(Fields!PctComplete.Value >=.8, "Green", Fields!PctComplete.Value >=.5, "Amber", Fields!PctComplete.Value <.5, "Red") =Code.CalculateQuarterlyCommission(Fields!SalesAmount. Value) 52 Beware of potential SQL injection attacks when developing data sets with dynamic query strings

53 1 Designing a Basic Report

54 Introducing Report Interactivity Adding Parameters Toggling Visibility Adding Links to a Report Adding a Document Map Interactive Sorting 54

55 Adding Parameters Understanding Query Parameters Understanding Report Parameters Configuring Report Parameters Using Report Parameter Expressions 55

56 Understanding Query Parameters A query parameter limits the number of rows retrieved from the data source Adding a query parameter to a query in a dataset automatically creates a report parameter and mapping Query parameters for SQL Server and Analysis Services sources are prefixed with the @ symbol SELECT * FROM dbo.vReportSalesPersonSummary WHERE CalendarYear = @Year AND CalendarQuarter = @Quarter 56

57 Understanding Report Parameters A report parameter is most commonly used to filter data −At report execution time, users are prompted to provide the report parameter value −The report parameter value can filter data by −Mapping to a dataset’s query parameter −Filtering one or more data regions Other uses include −Formatting the report presentation −Controlling sorting and grouping −Configuring report drillthrough and subreports −Securing data by using linked reports 57

58 Configuring Report Parameters Parameter properties −Name −Data type −Prompt −Multi-value −Available values −Non-queried −From query −Default values −Non-queried −From query −Null 58

59 Configuring Available Values Available values are presented to the user in a drop-down list Non-queried values are static Queried values are retrieved from a dataset 59

60 Configuring an All Item Insert a new item into the report parameter’s available values Modify the data-retrieving dataset’s WHERE clause SELECT -1 AS EmployeeKey, '(All)' AS EmployeeName UNION SELECT EmployeeKey, LastName + ', ' + FirstName FROM dbo.DimEmployee WHERE SalesPersonFlag = 1 AND EndDate IS NULL ORDER BY EmployeeName... AND (e.EmployeeKey = @EmployeeKey OR @EmployeeKey = -1) 60

61 Configuring Dynamic Parameter Values Available values of a parameter can be based on the selection of another parameter A dynamic parameter must retrieve its available values from a query Add query parameter for first parameter to query for dynamic parameter’s dataset Place parameters in sequential order: SELECT DISTINCT CalendarQuarter, 'Quarter ' + CAST(CalendarQuarter AS CHAR(1)) AS CalendarQuarterLabel FROM dbo.DimTime WHERE CalendarYear = @Year 61

62 Configuring Multi-Value Parameters Configure the report parameter as Multi-value Modify the data-retrieving dataset’s WHERE clause... AND CalendarQuarter IN (@Quarter) 62

63 Using Report Parameter Expressions Parameter properties Multi-value parameter properties =Parameters!Year.Label =Parameters!Year.Value =Parameters!Quarter.IsMultiValue =Parameters!Quarter.Count =Parameters!Quarter.Value(n) =Parameters!Quarter.Label(n) =Split("Value1,Value2,Value3", ",") =Join(Parameters!Quarter.Value, ", ") 63 Inclusion of a text box describing the parameter selection is considered best practice

64 Toggling Visibility Hide any report item, including groups, columns, or rows in a table or matrix Toggle visibility state by clicking another report item Use hidden items to provide a report that shows summary data with ability to drill to detail data Use only for reports rendered in HTML or Excel 64

65 Drill-Down Example 65

66 Adding Links to a Report Add links that let users −Open Web pages or other reports −Jump to another location within the same report Reporting Services supports three types of links −Jump to Report for drillthrough reports −Bookmarks −Jump to URLs for hyperlinks 66

67 Drillthrough Reports Accessed by clicking a link in a text box or image Enabled only for reports rendered in HTML Often receive parameters passed from the source report 67 Tip: Format a drillthrough text box to indicate there is a link (i.e., set Color to Blue and TextDecoration to Underline)

68 Bookmarks Link to another area or page in the same report −Can be set for any report item −Can be added only to a text box or image −Work only for reports rendered in HTML To develop a report with bookmarks −Set a bookmark on the destination report item −Add bookmarks to report items that users will click 68

69 Hyperlinks A standard HTML link to open a Web page or other resource −Can be added to any report item −Works only for reports rendered in HTML, Excel, or PDF To develop a report with hyperlinks −Add a static URL to a report item −Add an expression that evaluates to a URL to a report item 69

70 Adding a Document Map Provides users easy navigation through a large report −Displays a hierarchy of links next to the report −Opens report location corresponding to the link when a link is clicked −Works only for reports rendered in HTML, Excel, or PDF To add a document map −Add a document map label to any report item −Add a document map label to multiple groups for hierarchical links 70

71 Document Map Example 71

72 Interactive Sorting Enables the user to change sort order and direction Allows sorting of all groups in the report or just the current group Allows sorting on different scopes Works only for −Reports rendered in HTML −Text boxes configured as a data region or group headers 72 Tip: Where multiple columns support interactive sorting, the user can sort multiple columns by pressing the Shift key during column selection

73 Extending Reports with Custom Logic Embedding Report-Specific Code Referencing Logic in Assemblies 73

74 Embedding Report-Specific Code Add a VB.NET code block to the report −The report server automatically adds references to −Microsoft.VisualBasic −System.Convert −System.Math −Developers can leverage the.NET Framework libraries Use the Code element to refer to constants and functions in the code block 74 Tip: Use embedded code for complex functions or functions that are used multiple times in a single report

75 Code Example Public Function CalculateQuarterlyCommission(TotalSales As _ Decimal) As Decimal Dim commission As Decimal If (TotalSales <= 200000) Then commission = TotalSales * 0.025 ElseIf (TotalSales <= 500000) Then commission = 5000 + ((TotalSales - 200000) * 0.015) Else commission = 8750 + ((TotalSales - 500000) * 0.01) End If Return commission End Function Reference in report expressions =Code.CalculateQuarterlyCommission(Fields!SalesAmount.Value) 75

76 Referencing Logic in Assemblies Add an assembly reference to the report −Use any language, not just VB.NET −Call static or instance methods Deploy the assembly to: −Report developer’s machine Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies −Report Server’s bin folder 76 Tip: Use assemblies to maintain code in a single place and share it across multiple reports

77 2 Adding Interactivity to a Report

78 78

79 © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.


Download ppt "Event Title Event Date. Module 04—Introduction to SQL Server Reporting Services Name Title Microsoft Corporation."

Similar presentations


Ads by Google