Migrating from BusinessObjects’ Crystal Reports to SQL ...



[pic]

Migrating from Business Objects Crystal Reports to SQL Server 2005 Reporting Services

SQL Server 2005 Reporting Services Whitepaper

Published: April 2006

Applies To: Microsoft® SQL Server™ 2005 Reporting Services

Summary: This document assists Crystal Report designers with migrating to Microsoft® SQL Server™2005 Reporting Services using a step-by-step migration strategy.

Copyright

The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date 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 date of publication.

This White Paper 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 document 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 document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document 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, e-mail address, logo, person, place, or event is intended or should be inferred.

© 2005 Microsoft Corporation. All rights reserved.

Microsoft and Visual Studio are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.

All other trademarks are property of their respective owners.

Table of Contents

Migrating from Business Objects Crystal Reports to SQL Server 2005 Reporting Services 1

Copyright 2

Table of Contents 3

Introduction 4

Comparing Business Objects Crystal Reports 8.5+ to SQL Server 2005 Reporting Services 5

Strategic Benefits of Migrating to SSRS 5

Other SSRS Benefits 6

Crystal Reports – SSRS Compared 6

Preparing to Convert to SQL Server 2005 Reporting Services 8

Analyze Your Current Reporting Solution 8

Identify Consolidation and Standardization Opportunities 10

Plan Your Migration 10

Migrating Crystal Report Sections to SQL Server 2005 Reporting Services 10

Connection, Data Source, and Parameters 12

Report Header and Report Footer 17

Page Header and Page Footer 19

Row-Level Data, Groupings, and Subtotals 21

Formulas and Custom Functions 28

Migrating Additional Crystal Report Features to SQL Server 2005 Reporting Services 31

Matrix Reports 31

Charts 35

Multiple Data Sources and Subreports 35

Linked Reports 37

Using Alternative Migration Techniques 40

SQL Server 2005 Reporting Services Report Wizard 40

Third Party Applications 40

Summary 41

Useful Links for SQL Server 2005 Reporting Services 42

Introduction

All businesses need a reliable and efficient reporting solution. Some organizations develop their own in-house solutions, while other organizations implement solutions using products available in the market. For many years, Business Objects Crystal Reports was the mainstream option for business reporting solutions, as evidenced by the bundling of Crystal Reports with other applications including Microsoft Visual Studio. While Crystal Reports has worked well for many companies, with the recent release of SQL Server Reporting Services, companies are re-evaluating their purchasing decisions and looking for a more unified and cost effective reporting solution.

Microsoft SQL Server 2005 Reporting Services (SSRS) is the emerging solution of choice for businesses requiring enterprise reporting capabilities and competes directly with top-tier reporting solutions like Crystal Reports. Because SSRS ships with SQL Server 2005, companies can fully leverage their investment in SQL Server and benefit from the deep integration with the other areas of the product. Some of the latest enhancements to Reporting Services, including an ad-hoc report designer called Report Builder, bring Microsoft to the forefront of the reporting solutions market.

Because there are so many companies using Crystal Reports today who also own SQL Server and want to begin using SSRS as a lower cost alternative, there is a need to guide Crystal Reports designers with the migration of their current Crystal Reports solution to SSRS. This document will focus on the manual migration effort for Crystal Reports 8.5 and above and includes a section-by-section comparison of report information from Crystal Reports to that of SSRS. This approach will also introduce Crystal Reports users to SSRS and demonstrate the similarities of the two systems.

By studying actual migration efforts, we have observed that a large number of migrated reports are tabular and use features such as formulas, groupings, and parameters. While much of the functionality in Crystal Reports is available in SSRS, the scope of this paper is limited to the migration of specific sections detailed in Table 1.

Table 1 – Crystal Report sections scoped for this paper and comparable SSRS Report Sections

|Crystal Report Sections |SSRS Sections |

|Connection, data source, parameters |DataSet |

|Report header and report footer |Page header and page footer |

|Page header and page footer |Page header and page footer |

|Row level data, groupings, subtotals |Table control |

|Formulas and custom functions |Expressions, inline code, custom DLLs |

Please note the semantic layers (Universe and Business View) in more recent versions of Crystal Reports are not considered in this document, although SSRS does include similar functionality that insulates the business users from the complexities of relational and online analytical processing (OLAP) data sources. Through the Report Builder of SSRS, end users may create ad-hoc reports using predefined report models to act directly against relational data sources. Additionally, SQL Server 2005 introduces a new concept, the Unified Dimensional Model (UDM), which, like the Business Objects Universe view, is a meta data layer that sits on top of the physical database. Some of the key benefits of the UDM over the Business Objects Universe view include:

• Provides a method for expressing and managing Key Performance Indicators (KPIs).

• Provides a transparent aggregate definition, management, and navigation engine.

• Provides an advanced calculation language (MDX) that is more expressive than SQL and understands multidimensional data.

• Supports parent-child/unbalanced hierarchies in addition to ragged hierarchies.

• Enables the definitions of subsets (perspectives) of the overall semantic layer to simplify presentation to the user, as opposed to relying on multiple separate universes with copies of common classes and objects.

• Provides transparent management of query contexts, thereby removing this complexity from the design of your semantic layer.

• Enables server-side integration of data from heterogeneous systems, without extract, transform, and load (ETL) tasks.

• Translates meta data, enabling users to view and consume meta data using their own national language during the creation of reports.

To learn more about the SSRS Report Builder capabilities and the SQL Server 2005 UDM, please visit the Books Online references below.

Report Builder Books Online

Unified Dimensional Model Books Online

Lastly, some basic knowledge of SSRS is required when migrating Crystal Reports to SSRS. To further assist in your reading, throughout this document there are links to SSRS Books Online to provide additional coverage on specific SSRS topics.

Comparing Business Objects Crystal Reports 8.5+ to SQL Server 2005 Reporting Services

Strategic Benefits of Migrating to SSRS

Making the decision to migrate your existing Crystal Reports to SSRS requires a thorough comparison of the two products to determine which is best for your business. In addition to just looking at features, some key strategic questions to ask during this evaluation are:

• How well does my reporting solution integrate with the rest of my Business Intelligence (BI) technologies?

• How well does my reporting solution integrate with my databases and data sources?

• How easy will it be for my developers to learn how to build and deploy enterprise reports?

• Is the complexity of my current reporting solution preventing its deployment and use for better decision making?

• What are the maintenance and administration costs of my current reporting solution?

• What will a reporting solution cost my business?

Deep integration with Microsoft Business Intelligence

With the release of SQL Server 2005, Microsoft has taken extraordinary steps to bring to market a complete enterprise Business Intelligence platform that integrates all aspects of Business Intelligence into one easy-to-use architecture. Not only does SQL Server 2005 include a new performance-enhanced database engine, it also includes Analysis Services for building OLAP cubes and data mining, powerful Integration Services for performing extract, transform, and load (ETL) tasks from various data sources, and Reporting Services for Operational Reporting.

Unified and consistent development model

Because the tools included in the SQL Server Business Intelligence Development Studio, such as the Report Designer, leverage the Visual Studio framework, developers benefit from a consistent development methodology and easier learning process when developing applications that require both Visual Studio and Reporting Services. Additionally, unlike Reporting Services for SQL Server 2000 which required a Microsoft Visual Studio .NET 2003 license, SQL Server 2005 includes a set of design tools included in the “SQL Server Business Intelligence Development Studio” for report design, development, and deployment. SSRS also adds additional controls, like the “ReportViewer” control, to Visual Studio 2005 and Visual Web Developer Express, so you can embed reports within your .NET applications or Web sites.

Inclusive pricing and value for money

Finally, baseline Reporting Services functionality has even been added to SQL Server 2005 Express with Advanced Services, so you can benefit from basic local reporting without accruing additional cost. So, if you currently have an instance of SQL Server 2005, or are thinking about implementing one, consider leveraging your investment by using SSRS for your reporting needs instead of paying potentially hundreds of thousands of dollars for third-party reporting solution products.

Other SSRS Benefits

SSRS has several other benefits to consider. One of the key concepts of the product is its use of XML to describe reports, data sources, report models, and even service configuration. Microsoft’s Report Definition Language (RDL) is an XML schema used to describe reports built using Reporting Services Report Designer or Report Builder. RDL documents promote an extensible and open report document format that can be easily shared between applications. Another feature of SSRS is its extensibility. By extending SSRS, application developers can create new custom data sources, new delivery capabilities, new rendering options, or new security. Additionally, Web Services can be used as data sources and custom report controls can be easily created and used in reports. Lastly, SSRS introduces Report Builder which allows users to build ad hoc reports from the Report Manager and to save these reports for future reference. For additional information about new features and enhancements in SSRS, refer to the Microsoft SQL Server 2005 Reporting Services Web site.

Crystal Reports – SSRS Compared

Table 2 provides a brief comparison of Business Objects Crystal Reports Server and Microsoft SQL Server 2005 Reporting Services features.

Table 2 – Comparing Crystal Reports Server and SSRS Product Features

|Feature |Crystal Reports |SSRS |

| |Server | |

|Report Server Features | | |

|Publishing |InfoView and Windows client |Visual Studio-based Report Designer, Web-based |

| | |Report Manager (main user interface), Microsoft|

| | |Windows SharePoint Services, Report Viewer |

| | |control |

|Schedule calendar |Template schedules can be used by |Shared schedules can be used by different |

| |different reports |reports |

|Export formats |Word, Excel, PDF |Excel, Text, XML, PDF, TIFF, MHTML (or custom |

| | |rendering extensions) |

|Delivery channels |MAPI, file, FTP, e-mail |E-mail, file share (or custom delivery |

| | |extensions) |

|Data-based subscriptions |Available (through Business View |Dynamic query-based subscriptions |

| |semantic layer only) | |

|Alerts |Available |Available |

|Events |Custom, file, and scheduled |Customizable via Web services application |

| | |programming interface (API) |

|Report history |Report instances |Snapshots |

|Linked reports |Available via coding of hyperlinks |Simple dialog to create links to a shared |

| |only when using Crystal Reports Server|report with the option to customize properties |

| |or BusinessObjects Enterprise |of the linked report |

|Report Types | | |

|Drill down reports |N-depth levels |N-depth levels |

|Report with subreport |Only one level of subreports |N-depth levels |

|Cross-tab reports |Available |Available |

|OLAP reports |Available |Available |

|Multi-column reports |In details and groups |In details and groups |

|Labels |Standard or user-defined |User-defined |

|Report Object Features | | |

|Maps |MapInfo (ActiveX Control) |Available |

|Formulas |Crystal or Basic syntax, formulas can | expressions or embedded .NET assembly |

| |be reused in server repository |objects |

|SQL expressions |Sentences processed by SQL engine |Not needed because there is direct interface to|

| |(formulas processed by Crystal engine)|SQL database native dialect |

|Parameters |Dynamic parameters available (only |Dynamic parameters available |

| |when Business View or Universe is | |

| |used) | |

|Cascading parameters |Available only in Business Views |Available. Can define values for one parameter |

| | |based on another parameter’s value |

|Pictures, lines, figures |Not possible to apply conditional |Fully customizable |

| |formatting | |

|Custom- and user-defined functions |Functions from a report can be |Use .NET assemblies |

| |exported to global repository | |

|Data region |Must use several detail sections, |Database field brings back first record for |

| |subreports, and user functions |display. Data region controls display of |

| | |multiple records |

|Shared data sources |Business view functionality |Can be shared by multiple reports |

|Multiple data regions on a report (tables,|Not available |Available |

|matrices, charts, etc) | | |

|Grouping and Sorting Features | | |

|Top-N, bottom-N, top%, bottom % |Available, includes wizards |Available |

|Export |Export through viewers |Exports through viewer or subscription services|

| | |using rendering extensions |

|Viewer Features | | |

|Formats |Native Crystal, Excel, PDF, RTF, Word |HTML 3.2/4.0, PDF, Excel, XML, CSV, TIFF, MHTML|

|Navigation in parts |Can be defined |Use bookmarks on report objects |

|Group navigation |Available as group tree |Available as document map |

|Drill-down on same page |Not available |Available |

Preparing to Convert to SQL Server 2005 Reporting Services

Analyze Your Current Reporting Solution

Once you have made the decision to migrate your existing Crystal Reports to SSRS, the first step will be to determine how your current reporting solution will be duplicated in a Reporting Services solution. To start, consider the users of your reporting solution. As shown in Figure 1, there are generally three types of users in an organization that interact with reporting: information designers, information analysts, and information workers.

[pic]

• Information Designers – Activities include designing and deploying reports, creating report models/semantic layers, and administering the overall reporting solution.

• Information Analysts – Activities include viewing and analyzing reports distributed by the information designers and creating additional reports.

• Information Workers – Activities include using the data in the reports provided by the information designers and information analysts to make business decisions. Note: delivery channels such as Microsoft Office and e-mail are not listed above but are supported by both product sets.

After determining how the different user types will interact with SSRS, you next need to study the reports in the current Crystal Reports solution. Develop a list of all reports and capture important information relevant to each report, such as:

• Is the report still being used by the organization?

• What users and groups use the report?

• How frequently is the report accessed?

• How is the report accessed?

• Is the report used in other reports?

• What is the data source?

• Are there different products to access different data sources (Crystal Reports, Web Intelligence, and OLAP Intelligence)?

• What information is being displayed?

• What business decisions are being made based on the report?

By organizing and capturing important information about your report consumers, you will better understand their common characteristics. With this list prepared, you can begin defining your SSRS solution.

Identify Consolidation and Standardization Opportunities

More often than not, the implementation of a new reporting solution provides an opportunity to consolidate many reports created over the years. By significantly reducing the number of reports, support for these reports is simplified while data visibility and organization is improved. For example, you can consolidate reports that duplicate information or no longer serve a purpose. Your analysis of your current reporting solution should help you discover consolidation opportunities.

Additionally, you should use this time to consider ways to better standardize reports. To start, consider implementing stored procedures to replace SQL statements in your reports. By using stored procedures, you can protect your reports from malicious attacks, such as SQL Injection, and potentially improve the performance of your queries.

Plan Your Migration

When you have completed analyzing your current Crystal Reports reporting solution and identified any consolidation and standardizing opportunities, the next step is to plan the migration details of Crystal Reports to SSRS. This planning will use your analysis results to identify which report types and users to migrate first to SSRS. Generally, a phased migration is the best approach for the end users as well as the design team. Each phase should have a formal communication process shared with all end users. At minimum, communicate the date of the migration, any possible downtime to the users, and a support contact for any issues the users may encounter after the migration. Once all phases have been defined, a target date can be set for the retirement of the Crystal Reporting Servers.

Additionally, you may want to budget some time for training your end users on the Report Manager and Report Builder. During this training, you can solicit user feedback on the new system as well as define new report models for the Report Builder ad hoc queries.

Migrating Crystal Report Sections to SQL Server 2005 Reporting Services

Now that you have completed analysis of your reporting solution and have a list of reports to convert, you’re ready to perform a section-by-section migration process for each report. To begin, let’s take a look at a typical Crystal Report. In this report, sales data is reported for each territory. Grouping is performed first by territory and then by sales person.

[pic]

Figure 2: Sample Crystal report design interface

[pic]

Figure 3: Crystal report sample preview

This Crystal Report connects to the AdventureWorks database and reports on Territory Sales. Two commands are used to return data for the report, Command and Command_1. Command returns the sales data for each employee in each region. Command_1 returns a distinct list of all territories. There is also one parameter defined, “Terr,” that represents the different territories available for selection when viewing the report. Lastly, formulas are used to toggle visibility of the Page Header text box for the text “Territory Sales Cont’d.” If the page number is 1, the text box is suppressed; otherwise, the text box is displayed.

Next, let’s review the steps required to migrate the report in Figure 2 and Figure 3 to SSRS:

• Create a new Report Project in SQL Server Business Intelligence Studio

• Data Tab - Create a new DataSet and configure the Data Source connection information

• Data Tab – Create the Query information in the DataSet to retrieve the necessary fields for the report

• Data Tab – Create any parameters to the DataSet Query and test the Query

• Layout Tab – Create the Report Headers and Footers

• Layout Tab – Create the Page Headers and Footers

• Layout Tab – Establish row level data, groupings, and subtotals

• Layout Tab - Create Formulas and Custom Functions

• Layout Tab – Create additional features such as matrices, charts, multiple data sources, subreports, and linked reports.

To get started, open SQL Server Business Intelligence Development Studio and create a new Report Server Project. When the project is created, you see a standard report template similar to Figure 4 below. A report template includes three tabs: Data, Layout, and Preview. The Data tab allows you to configure data sets for a report. A report may have multiple data sets from multiple heterogeneous sources. The Layout tab is where you design the report. The Preview tab allows you to preview your report with actual data from the report dataset(s).

[pic]

Figure 4: Visual Studio .Net 2005 standard report template

Connection, Data Source, and Parameters

The first task required to migrate a report is to set up the connection information to the data source. From the Crystal Report migration sample in Figure 5a, the data source will be SQL Server. In SSRS, this connection information is called a data source. A dataset contains a reference to a data source as well as query information. You can add a data source as a separate step, or as part of adding a new dataset. To set up a new dataset for your report, click the DataSet dropdown list on the Data tab of the report, and click New DataSet.

[pic]

Figure 5a: OLE DB connection to SQL Server AdventureWorks database

[pic]

Figure 5b: Data Source configuration page of a DataSet

The Data Source dialog box displays (Figure 5b). Type a name for your data source and then select the Type. Next, click the Edit button to define the connection properties for the data source.

[pic]

Figure 6: Connection Properties for a data source

After specifying the connection properties and testing the connection, click OK to return to the Data Source dialog box. Click OK again to save the Data Source information and return to the Data tab of the report. You should notice the TerritorySales dataset now available in the Datasets window. So what’s just occurred? Essentially, we’ve just created a container for the results of our query to be stored once a report is run. The dataset acts as an in memory representation for the results the query. To learn more about datasets and data sources in SSRS, visit the Working with Data in Reporting Services topic in Books Online.

The next step is to generate a query to return a list of fields from this data source to populate the dataset created above for use in the report. Since the data source for the sample Crystal Report is the AdventureWorks database on a SQL Server, we can paste the SQL query from the sample Crystal Report directly into the query pane of the Data tab (Figure 7a and 7b)

[pic]

Figure 7a: Command query from sample Crystal Report

[pic]

Figure 7b: Command query from sample Crystal Report

pasted into data query for SSRS report

You could alternatively call a stored procedure here as well by changing the value in the Command Type dropdown list. (See Books Online: Retrieving Relational Data from a SQL Server Database for more information).

You also need to create one more dataset that lists all the available territories in the AdventureWorks database. This dataset will be used as a parameter source in the next section. Repeat the previous steps to create another dataset using the AdventureWorks data source and name the dataset Territories. Use the same query from Command_1 in the Crystal Report sample:

Select distinct(Name) from Sales.SalesTerritory

Finally, the sample Crystal report includes one parameter, “terr,” to allow users to select the territories to view (Figure 8a) when the report is run.

[pic][pic]

Figure 8a: Sample Crystal Report parameter

and parameter defaults from Command_1

In SSRS, the data query can be easily updated to include a “where” clause to automatically configure the report to display optional parameters. In Figure 8b, the data query has been updated to include the following where clause:

Where st.name IN (@terr)

This statement will return all the territories from the data source whose name is in a territory list submitted by the user.

[pic]

Figure 8b: Updated DataSet query to use a parameter

An SSRS report also contains a report parameters properties page where the designer can view all the parameters of the data query in one place. To access the Report Parameters page click the Report menu and then click Report Parameters.

Upon opening the Report Parameters page, the terr parameter is automatically detected by SSRS and added to the parameters list. The basic properties of a parameter include name, data type, and prompt. You may additionally select the value modes (allow nulls, multi-valued, etc), available values to display for the parameter, as well as a default value(s) to use when the report first executes.

To configure the additional parameter information from the query in Figure 8b, configure the prompt for the terr parameter to Territory. Next, set the value mode to Multi-value and Allow blank value. When setting the available values, designers can input static nonqueried values or use a dataset. For this sample report migration, use the Territories dataset to populate the parameter list. Use the Territories Name field as both the Value and Label field. Because the parameter is a multi-value parameter, users will be able to select one, two, or all territories to view at once. Finally, the default value section also allows for static, queried, or null values to be defined. Select the “From Query” option and use the Territories dataset once again with the Name field of the data set as the Value field. Once complete, the terr parameter should look something like figure 9.

[pic]

Figure 9: Report Parameters configuration page

Once all parameters have been entered for the report, click OK to return to the Data tab. Now that you have a report parameter, you can update the query to use the parameter. When adding a parameter to a query or stored procedure, you precede the parameter name with the @ symbol, just like any other SQL variable. This query parameter serves as a placeholder to be replaced at execution time with the parameter value selected in the report.

For more information about report parameters, visit the Using Parameters in a Report topic in Books Online for SSRS.

Finally, to test the dataset, you can run the query and view the result set by clicking the red exclamation mark above the query pane. The results display below the query pane.

Report Header and Report Footer

The report header and report footer are generally sections that are displayed on the first page and last page respectively of the report. However, unlike Crystal Reports, SSRS does not have explicit Report Header and Report Footer sections. Instead, you can use the Page Header and Page Footer sections.

Let’s examine the Report Header and Footer sections from the sample Crystal Report in Figure 3 above.

[pic]

Figure 10a: Report Header and Report Footer

sections from the sample Crystal report

In Figure 10a, the report header of the sample Crystal Report contains an image, a textbox object with the report title, and a date stamp to show when the report was created. The report footer contains a simple textbox object indicating the end of the report.

To migrate these sections to SSRS, click the Layout tab of the report template to view the report layout. To add a Page Header to the report, click the Report menu, and then click Page Header. This section is now available for use in the report layout form. Next, you’ll use a rectangle as a container for an image and a text box that comprises the report header. Drag a Rectangle control from the Toolbox window and drop it in the Page Header. At this point you should notice the similarities between SSRS Crystal Report’s WYSIWYG report design as well as pixel perfect report creation (i.e. Controls can be easily dragged and dropped onto the design surface and positioned to the pixel location of choice with great flexibility.)

[pic]

Figure 10b: Typical report design with Page Header and

Page Footer areas added.

Next, add image and text box controls to the rectangle and adjust the size of the rectangle as needed. Because these controls should be displayed only on the first page of the report, you need to change the Visibility property of the rectangle control. Right-click the Rectangle control, and click Properties. In the Properties window, locate and expand Visibility. Click the list box for the Hidden property to select Expression. An expression is very similar to a formula in Crystal Reports, but uses Visual Basic .NET syntax. By using an expression, a designer can programmatically define a value for a property. To toggle the visibility of the rectangle control, you can create an expression (see Working with Expressions in Reporting Services for more information) using a Global variable—PageNumber.

[pic]

Figure 11: Page Header Rectangle control

updated with Image and Textbox control.

[pic]

Figure 12: Using the Expression editor to show\hide

Rectangle control based on page number.

Click OK to close the Edit Expression dialog box. You have now completed your report header. By grouping information in a rectangle, you are able to show or hide the rectangle contents based on the current report page. You can use this same method for the Report Footer as well. Follow the same steps you just completed, but place the controls in the page footer. Change the expression for the page footer’s rectangle as shown here:

=IIF(Globals!PageNumber = Globals!TotalPages,False, True)

Page Header and Page Footer

The Page Header and Page Footer are generally sections that are displayed towards the top and bottom of every page respectively in a report. As you learned in the previous section, to include page headers or footers in a report, click the Report menu and then click Page Header or Page Footer.

Let’s examine the page header and footer from the sample Crystal Report.

[pic]

Figure 13: Page Header and Page Footer

sections from the sample Crystal report

Here the Page Header displays the column or field headings of the report as well as a text box which is conditionally suppressed. When the current page is Page 1, the text box is suppressed, but when the current page is NOT Page 1, the text box is not suppressed. SSRS includes the column headings in the table control as explained in the next section. For now, you can migrate the date stamp and the text box that contains the “Territory Sales Cont’d” to the page header in SSRS since these controls are static text. Since the date stamp is displayed at the top right corner of every page, you can use the page header to display this information. Drag a textbox onto the Page Header and position it in the top right corner. With the textbox selected, find the Value property in the Properties window, and then select the Expression option in the dropdown list to build the following expression:

=Replace(DateString(),"-","/")

This expression simply reformats the date string to look like the Crystal Reports date string. Rather than type a function, you can select any function from a list in the Expression editor. Here, functions are organized by type in the Custom Functions list. The Replace function is in the Text group while the DateString function is located in the Date & Time group. Alternatively, you can use the format property of the textbox to set the date format (dd/MM/yyyy) and set the value for the textbox to “=Now” for this particular example.

Next, drag and drop another textbox into the Page Header and type “Territory Sales Cont’d” in the textbox. Since this title should display on all pages except the first page, use the Visibility property of the text box to build an expression that shows or hides this control conditionally.

To migrate the page footer, drag and drop a textbox control to the Page Footer section. Then, set the Visibility expression to display the page footer information on all pages except the first page.

[pic]

Figure 14: Updated page header and page footer information in SSRS

To learn more about report layout in SSRS, visit the Understanding Report Layout and Rendering topic in Books Online for SSRS.

Row-Level Data, Groupings, and Subtotals

At the heart of most reports is the row-level data returned from the data source. Row-level data is often grouped by common fields. A report may also include subtotals for each group. Let’s examine the available row-level data, groupings, and subtotals from the sample report we are migrating.

[pic]

Figure 15: Report details, groupings, and

subtotals from sample Crystal report

In Figure 15, there are two groups for the row-level: Territory and Last Name. In this example, the data is also displayed in a tabular format for easy drilldown into each group. Lastly, the report shows summary data (subtotals) of the total sales by territory and by sales person.

As mentioned in the previous section, SSRS provides a table control to display the column headings in a tabular report.

Below in Table 3, is a listing of the controls, known as data regions in SSRS, you can use in a report and the corresponding Crystal Report Control (if available):

Table 3 – Comparing Crystal Reports and SSRS Controls

|Crystal Report Control |SSRS Control |SSRS Description |

|Text object, label, field |Textbox |Displays all text data in a report. A table or a matrix cell |

| | |is, in fact, a textbox. You can place a textbox anywhere on a |

| | |report to display labels, fields, or calculated data. |

|Line |Line |A graphical element you can place anywhere on a page. You |

| | |define a line with a start and end point and specify styles, |

| | |such as weight or color. Data is not associated with a line. |

|N/A |Table |Using a table data region, you arrange data into columns and |

| | |rows. Tables have a fixed number of columns, but a variable |

| | |number of rows based on the data in the dataset. There is no |

| | |limit to the number of columns you can add to a table. You can|

| | |change the design of a table cell to span multiple columns. |

| | |You can also add grouping and sorting to arrange data within |

| | |the table structure. |

|Crosstab |Matrix |Using a matrix data region, you arrange data into columns and |

| | |rows in a structure similar to a crosstab or pivot table. |

| | |Unlike a table, which has a static set of columns, the number |

| | |of matrix columns can vary. |

|Box |Rectangles |Use rectangles as a graphical element or as a container for |

| | |other report items. When you place report items within a |

| | |rectangle, you can move them with the rectangle which is |

| | |useful for keeping numerous text boxes and other items |

| | |together in a report. |

|Group section |List |Repeats the controls it contains for each group in the |

| | |dataset. You can use a list for free-form reports or in |

| | |combination with other data regions. You can also nest a list |

| | |within another list to provide multiple groupings of data. |

|Picture |Image |An image displays binary image data in a report. You can use a|

| | |URL to display an image stored on a Web server, embed image |

| | |data in a report, or display an image from a database. SSRS |

| | |supports BMP, JPEG, GIF, and PNG files. |

|Subreport |Subreport |A subreport is an item in a report that points to another |

| | |report on the report server, which may be a full report that |

| | |could be run independently, or a report created solely for |

| | |embedding in a main report. When you define a subreport, you |

| | |can also define parameters to filter data in the subreport. |

|Chart |Chart |A chart is a data region that displays data graphically in a |

| | |report. You can choose from many different types of charts. |

| | |You can also change the style of the chart to include |

| | |different colors, symbols, and 3D effects. |

To reproduce the details, groupings, and subtotals of the sample Crystal Report in Figure 15, drag and drop the table control from the Toolbox into the body of the report. By default, a new table contains header, detail, and footer information. Additional information about the table control is shown in Figure 16 below. In particular, notice the table header in the table control displays column headings, unlike Crystal Reports which uses the page header.

[pic]

Figure 16: SSRS table control overview

First, assign a dataset to the table control. Click the table, and then click the Corner Handle to display the properties of the table in the Properties window. Locate the DataSetName property and assign the applicable dataset.

Next, configure groupings for the table. Click the table to display the Row and Column handles. Right-click one of the Row Handles, and then click Insert Group to display the Grouping and Sorting Options dialog box. The General tab in this dialog box allows you to specify the fields used to group the dataset. First, give the grouping a name. Next, select an expression for Group On. Since the first grouping is based on the territory name, select the Name field from the dataset. Keep the default values for everything else, and then click OK to return to the table. Your table now includes a new grouping, as shown in Figure 17.

[pic]

Figure 17: Adding a grouping to a table control

Next, add a second grouping for sales person. Repeat the previous steps to add a second group to the table based on SalesPersonID. Your table should now look similar to the one shown in Figure 18.

[pic]

Figure 18: Adding a second grouping to a table control

Now that your table includes groupings, you can start placing data into the table. Just drag and drop fields from the Datasets window onto the table. To continue with the sample Crystal Report, drag and drop the Name field into the first cell of the grouping header. Once the field is added to the grouping header, the table header is also updated with the field title. Alternatively, you can manually edit table headers just as you can in Crystal Reports. Also, notice the expression used in the first grouping header to refer to the value of the dataset field in Figure 19.

[pic]

Figure 19: Inserting dataset fields on a table

Now you’re ready to add SalesPersonID to the second cell of the second grouping row which will stagger the display of data. Because the second grouping should display the Sales Person’s first and last name, you need to create an expression to concatenate fields in the dataset. Select the textbox and then find the Value property in the Properties window. Select in the property’s dropdown list (or right click on textbox and click Expression), and then build an expression like this (See Figure 20 new Textbox value):

=Fields!FirstName.Value + " " + Fields!LastName.Value

[pic]

Figure 20: Textbox value created using an expression

The table in SSRS now contains all grouping information. The next level of detail in the sample Crystal Report displays the Sales Order Number and the Total Due for the order. Before adding more fields to the table, add another column. Right-click the last column in the table and select Insert Column to the Right. Adjust the column widths to make sure the table fits on the page. Then drag and drop the SalesOrderNumber and TotalDue fields to the third and fourth columns respectively of the Details row. The table should now look similar to Figure 21.

[pic]

Figure 21: Inserting fields in the table detail row

Again, notice the table header automatically includes the field name. Be sure to change column headings to match the headings in the Crystal Report. You can apply formatting by using the Report Formatting toolbar or by changing properties in the Properties window.

Now you’re ready to add subtotals by sales person and by territory. The first grouping header for Total Sales will display the subtotal for each territory. To calculate this subtotal, drag TotalDue into the fourth column of the first grouping header. SSRS automatically adds the Sum aggregate function to fields with a numeric data type. Repeat this step to add a subtotal by Sales Person to the second grouping header under the Total Sales column. At this point, your table should look similar to Figure 22.

[pic]

Figure 22: Calculating group subtotals

The final step in this section is to enhance the table by removing unused rows and applying formatting. When you added groups to the table, group footer rows were automatically created. Since these rows aren’t used in this example, you can click the table, right-click the row handle of the row to delete, and then click Delete Rows. Repeat this procedure to delete the remaining group footer row as well as the table footer row. When comparing Figure 22 above and Figure 23 below, the table control has now been formatted.

[pic]

Figure 23: Formatting the report

In the sample Crystal Report preview in Figure 3 above, the report hides the secondary grouping and the details of the report until a user clicks on a territory or sales person. To migrate this interactivity, you can add an interactive feature, like Hiding Report Items, to rows of a table control. Using the Visibility property for the table detail row and the second grouping row, you can show or hide these rows when you click a textbox in another row. To select the entire second grouping row, click the table and then click the corresponding row handle. The second grouping row is now highlighted and properties for the row are accessible in the Properties window. Locate the Visibility property and change the Hidden property to True. Next, change the ToggleItem property to the name of the textbox containing the grouping field for Territory. The ToggleItem property changes the value of the Hidden property from True to False when you click the specified textbox. Figure 24 shows the second grouping row selected and the ToggleItem property being set to txbTerritoryName, which is the name\id of the textbox in the first grouping row.

[pic]

Figure 24: Use the ToggleItem property to add report drilldown capabilities

Repeat the previous steps to set the ToggleItem for the table detail row. In this case, the ToggleItem property value is the textbox containing the second grouping for Sales Person.

Lastly, set the format of the Sales Total column to Currency. To do this, select the Sales Total column handle to highlight the entire column, and set the Format property for the column to C. Click the Preview tab to see how the report looks now, as shown in Figure 25.

[pic]

Figure 25: Migration report preview

Formulas and Custom Functions

In reporting, more often than not, the database fields do not always provide the data required for particular parts of a report and reporting solutions need alternative ways to generate data. Crystal Reports uses formulas and custom functions to do such data generation. A formula on a report uses expressions (Formula Workshop) to populate report items like text box objects. A few examples of formulas include creating calculated fields to add to a report, formatting text on a report, and using a custom function. Custom functions are more complex procedures you create in Crystal Reports to evaluate, make calculations on, or transform data in a report. Unlike formulas, where the scope of the formula is local to the report, custom functions can be saved to be used across multiple reports.

In SSRS, we’ve been introduced to the Expression Editor to perform calculations or manipulate strings of an SSRS control. This feature is very comparable to the formula workshop in Crystal Reports, but its scope is only to the control where the expression is defined. To create a more global report expression, SSRS allows designers to write custom functions accessible by the Expression Editor of the report. Custom functions are added via the Report Properties which you access by selecting Report Properties from the Reports menu. Here you can set various properties for the entire report. In this section, you’ll focus on the Code and References tab of the Report Properties dialog box.

To create functions that are easily referenced within the current report, you can use the Code tab to create Visual Basic .NET () functions. You can add multiple functions here. Currently, is the only language supported. For demonstration purposes, add a simple function to the code that sets the foreground color of the Territory Total Sales to red if the amount is greater than $10,000,000.00, as shown in Figure 26.

[pic]

Figure 26: code to set foreground color based on total sales

To use this new function, select the textbox containing the Total Sales for the Territory (the first grouping), and then add the following expression to the Color property:

=Code.setColor(Sum(Fields!TotalDue.Value))

Notice the “Code” keyword in the expression. This works like a namespace in SSRS to tell the expression editor where the function is located. Preview the report to confirm territories having total sales greater than $10 Million are displayed with a red font. This report design technique can focus attention on certain results in a report. Using the Code page of the Report Properties dialog box and the expression builder, designers can quickly and easily add more functionality to reports.

[pic]

Figure 27: Preview Code changing

foreground color of Territory Sales subtotal

It is important to reiterate that when migrating formulas or custom code from a Crystal Reports into the code tab of the Report properties, the formulas and custom code must be converted to a function.

In SSRS, to create custom reusable code, like custom functions in Crystal Reports, the Reference tab of the Report Properties is used. The Reference tab allows designers to reference an assembly for the report. An assembly is precompiled code that can be shared among applications. Assemblies are a great way to keep a library of common methods together in one place. For instance, the sample report displays territory sales for the AdventureWorks company. If a project requires multiple reports related to sales and financial information, you could easily write an assembly to define commonly used functions. You could then reference this assembly in all reports in your project. Additionally, if any changes were required, all changes made to the assembly propagate to all reports. Furthermore, because it is a .NET assembly, you can use the assembly in any .NET application. Lastly, you can circumvent the limitation that report code must be written in by using an assembly which can be written in any .NET language you prefer. (However, you must have a Visual Studio license to build custom .NET assemblies.)

To demonstrate how to use a custom assembly in a report, you can recreate the embedded code example used in Figure 26. Using Visual Studio .NET, construct a class library file using C#.NET rather than .

[pic]

Figure 28: Custom assembly to return a

color string based on the inputted value.

Once you compile the class library file as an assembly, copy the assembly to the application folders for Report Server and Report Designer. The default location of the bin folder for the report server is C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\bin. The default location of the Report Designer is C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies. Please see Reporting Services Online Help for more information about deploying a custom assembly to a report.

Next, you reference this assembly by using the Reference tab in the Report Properties dialog box. In the Reference section, click the ellipsis button and browse to the assembly in the Report Designer application folder. Select the assembly and click Add. Finally, click OK to return to Report Properties. Because the setColor function in the assembly is a static method, you don’t need to populate the class information for the assembly.

[pic]

Figure 29: Referencing the custom assembly in the Report Properties

Click OK to close the Report Properties dialog box. Now you can update the expression for the Total Sales by Territory textbox color to use this custom assembly. To do so, modify the expression to call the static method in the assembly like this:

=RSLibrary.MyReportFunctions.setColor(Sum(Fields!TotalDue.Value))

Preview the report to see territories with total sales greater than $10 Million are once again displayed with a red font.

Migrating Additional Crystal Report Features to SQL Server 2005 Reporting Services

Matrix Reports

In a matrix report, you arrange data into columns and rows much like a crosstab or pivot table. By contrast to a table, which has a static set of columns, the number of matrix columns can be dynamic. Like Crystal Reports, SSRS includes a matrix control (or crosstab control) to generate this type of report. However, unlike the Crystal Report matrix control, the SSRS allows for fold/unfold or toggle behavior in its matrix control. In addition, an SSRS report can also include a mix of matrices and other data regions like tables and charts on a single report. This gives designers much more flexibility in design. Additional information about the SSRS matrix control is shown in Figure 30 below. To create a matrix report, create a new report in SQL Server Business Intelligence Studio, create a dataset for the report, and then drag and drop a Matrix control onto the Report Layout.

[pic]

Figure 30: Matrix control overview

[pic]

Figure 31: Empty matrix view

In Figure 31, notice the control has labels for the rows, columns, and data regions. The first task of migrating a Crystal Report matrix report is to create a new dataset in the SSRS report using the data source and query information from the Crystal Report. Using the new dataset, you can drag and drop fields onto the SSRS matrix. The dataset for this sample matrix report, shown in Figure 32, connects to the AdventureWorks data source and returns company sales information for each department during the years 2002 and 2003.

[pic]

Figure 32: Matrix with grouped dataset fields

After placing fields from the dataset onto the matrix, the matrix can now be formatted. Like the table control in SSRS, the columns and rows of a matrix can be hidden or displayed based on user interaction with the report, but the process to add this functionality is slightly different. In the following example, you’ll toggle the visibility of the subcategory and the order quarter information when the user clicks the Category and Order Yearly textboxes, respectively. To do this, click the matrix, right-click the Corner Handle, and then click Properties. Next, click the Groups tab to see the grouping defined for the matrix (Figure 33). Click the _SubCat group and click Edit to view the Grouping and Sorting dialog box for this group. Click the Visibility tab to set the initial visibility of the group as well as specify the report item that toggles the visibility (Figure 34).

[pic]

Figure 33: Editing the matrix groups

[pic]

Figure 34: Edit visibility of Matrix1_SubCat group

Before you click OK to save the changes, click the Sorting tab. Here you can add sorting to the group based on any fields in the dataset. After defining sort order, click OK to return to the Matrix Properties dialog box. Repeat the previous steps to set the visibility and the sorting for Order Quarterly group. Lastly, set the sorting for the remaining groups in the matrix: Product Category and Order Year. Click OK when finished.

Lastly, add any desired formatting to the matrix to enhance its appearance (Figure 35).

[pic]

Figure 35: Preview of matrix report with visibility and sorting updates

For more information on the Matrix Data Region in SSRS, please visit the Working with Matrix Data Region topic in Books Online.

Charts

A chart is a great way to visually display data in a way that captures immediate attention. When migrating charts from Crystal Reports, use the existing data source, query, and parameters from the Crystal Report chart definition to create a new dataset in SSRS. Once the dataset is created, click the Layout tab and drag and drop a chart control into the body of the report (Figure 36). To customize the chart, right-click the chart and click Properties. Using the Chart Properties dialog box, you can configure and customize every aspect of the chart. Whether you need to set the chart type and dataset name, configure values for the x and y axis, or add visual effects, the Chart Properties dialog box is a one-stop shop to set up a chart.

[pic]

Figure 36: Default line chart type in SSRS

Another interesting point when migrating charts from a Crystal Report to SSRS is how SSRS handles the rendering of multiple charts and aggregate. In Crystal Reports, many report designers place charts and tables containing aggregate data in the report footer because the report must read the detail data before it can report any aggregate data. This constraint is a product of the multipass calculation engine in Crystal Reports. SSRS on the other hand overcomes this constraint by providing designers a free-form surface to layout their reports anyway they want. This includes placing tables with aggregates and side-by-side charts anywhere on a report.

Lastly, because SSRS is an extensible framework, you can purchase additional charts, gauges, and diagram types from third-party vendors. One vendor specializing in SSRS chart controls is Dundas (). To learn more about charts, visit the Working with Chart Data Region in Books Online.

Multiple Data Sources and Subreports

Crystal Reports and SSRS both have the ability to connect to a wide range of data sources, however using multiple data sources on a single report in Crystal Reports has been known to cause performance issues. These performance issues are a direct result of executing the second/subsequent SQL queries for every row of data returned by the primary SQL query. This could result in the launching of hundreds of distinct queries. To work around this issue, Crystal Report designers use multiple subreports on a single master report to display data from multiple data sources. SSRS, on the other hand, allows designers to create multiple data sources in a report that can be used in different data regions (controls), in a free form layout, to create the report they want to create without looking for obscure workarounds or compromising the report performance.

To demonstrate how to connect to multiple data sources in SSRS, open the tabular report created earlier to add a new dataset to the report. Using the Dataset dialog box, you can create a new data source to define a new connection. To follow this example, connect to Microsoft SQL 2005 Analysis Services. You should now have three datasets defined in the report. TerritorySales and Territory use the AdventureWorks database while OLAPDataSource uses the AdventureWorks OLAP database (Figure 37)

[pic]

Figure 37: Report sample with heterogeneous data source in a single report

In SSRS, a subreport is a report item that references another report on the report server. The referenced report can be a full report that can be viewed independently, or it can be a report created specifically for embedding in another report. When you define a subreport, you can also define parameters to filter data in the subreport. To add a subreport to your report, use the Subreport control in the Toolbox. After placing the Subreport control on the report, right-click the control to access its properties. Here you specify the referenced report and define parameters required for the subreport.

You may want to consider using a data region instead of a subreport. Because the report server processes each instance of a subreport as a separate report, performance can be adversely impacted. Data regions provide much of the same functionality and flexibility as subreports, but with better performance.

Linked Reports

When creating a link to another report in Crystal Reports, a designer must create an openDocument link on a particular field in a report to handle the report redirection. However, to use the openDocument function you must have Business Objects Enterprise installed to get access to a report repository

SSRS offers the ability to link and pass parameters to other reports quite easily by setting the navigation property for a given object. You can even link to reports located on other report servers using the URL Access capabilities in SSRS as explained later. To demonstrate the navigation property of a textbox, the following example uses the Sales Person column in the sample report to navigate to the Employee Sales Summary report (one of the samples included with SSRS). First, access the properties of the sales person textbox located in the second grouping of the table. Right-click this textbox and then click Properties as shown in Figure 38.

[pic]

Figure 38: Accessing the properties of a textbox

Click the Navigation tab of the Properties dialog box. In the Hyperlink section, select Jump To Report, and then select the target report in the dropdown list. To set the parameters to pass to the target report, click the Parameters button. SSRS creates a list of parameters from the target report. You can then associate static values or dataset values with selected parameters, as shown in Figure 39.

[pic]

Figure 39: Edit the “Jump to Report Parameters”

using static values and dataset field values.

Click OK until you return to the report designer. When you preview the report, expand the territory grouping to hover the cursor over the Sales Person’s name to see the pointer change to a hand.

[pic]

Figure 40: Preview report-linking functionality

Click a sales person’s name to navigate to the linked report using the parameters specified in the Jump To Report definition in the textbox properties.

[pic]

Figure 41: Target Sales Person report from Territory Sales report

Use the Navigation bar (Figure 42) at the top of the report to browse the current report or to return to the parent report.

[pic]

Figure 42: Linked report navigation bar

URL Access

You can also link reports in SSRS by using a report server URL. A URL request enables you to access reports, resources, and other items on a specific report server. Using URL access, you can also customize the report viewing and navigation experience for your users. The query string of the URL includes device information settings as well as report parameter values and a specific rendering format (Figure 43). You can also use URL access to embed hyperlinks to reports and other report server items in any Windows or Web applications you develop.

[pic]

Figure 43: Available methods to communicate with a report server

For more information on linking reports in SSRS, visit the Adding Links to Reports interactive topic in Books Online.

Using Alternative Migration Techniques

SQL Server 2005 Reporting Services Report Wizard

As with Reporting Services v1.0, SQL Server 2005 Reporting Services includes a Report Wizard to help start report development. The Report Wizard walks you through defining a data source, building a query, selecting a report type, grouping report data, and selecting a style for the report. To access the Report Wizard, right-click the Reports folder in the Solution Explorer of SQL Server Business Intelligence Development Studio, and click Add New Report. For more information on the Report Wizard, please visit Books Online.

Third-Party Applications

When migration efforts involve hundreds or thousands of reports, you may want to consider automating as much of the migration process as possible. Third-party service providers have recognized the need for companies to accelerate the process of migrating to Reporting Services and have developed applications and methods within a consulting engagement which will allow companies to reach their goal faster. A short list of some third party solutions include

|Partner Name |URL |

|Hitachi Consulting | |

|TCS | |

|Sonata Software Ltd. | |

|KTL Solutions | |

|90DegreeSoftware | |

|Jeff-Net | |

|Neudesic | |

|PLUS-IT | |

For more information, please visit the Reporting Services Partner page ().

Summary

In this paper, we explained various aspects of migrating from Crystal Reports to SSRS. First, to help you decide whether to migrate, we provided a high-level comparison between Crystal Reports and SSRS features along with an overview of some of the strategic benefits of migrating from Crystal Reports to SSRS. Next, to help you prepare for the migration, we described methods you can use to analyze your current reporting solution, to identify consolidation and standardization opportunities, and to implement a phased migration. Next, to help you perform the actual migration, we demonstrated a step-by-step migration process that mapped each section of a sample Crystal Report with the analogous SSRS section. Then, to help you see the range of capabilities in SSRS, we discussed additional features like matrices and charts. Finally, to decrease the time required to migrate, we explained how you can automate many of the steps of the migration. The information and techniques presented here will make your migration process easier and quicker.

Useful Links for SQL Server 2005 Reporting Services

• Reporting Services Tutorials:



• Scalability and Performance:

• Design Best Practices:

• Microsoft SQL Server Developer Center – Reporting Services



• Reporting Services Homepage



• SQL Server Books Online – Reporting Services

(SQL.90).aspx

-----------------------

Information Workers

Figure 1: Reporting user types

SQL Server 2005 Reporting Services Components

Information Analysts

• Report Viewer

• Report Manager

• Report Viewer

• Report Builder

• Report Manager

• Visual Studio 2005

• Report Designer

• Report Manager

• Model Builder

• Report Builder

Crystal Reports Components

Information Designers

• Crystal Reports (Windows client)

• [?]24B°ÆÐö

. 2 Ø è Øð0

2

.

0

S

U

îð¾À-$&\`Universe Designer

• Business View designer

• BusinessObjects Enterprise and Crystal Reports Server (Administration Console)

• Crystal Reports (Windows client)

• Crystal Reports Explorer

• InfoView

• View Crystal Reports through InfoView (BusinessObjects Enterprise and Crystal Reports Server portal) and third-party portals e.g. SharePoint

Page Footer Region

Page Header Region

Group 1 Footer Row

Group 1 Header Row

Group 2 Footer Row

Group 2 Header Row

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download