LogoASPAlliance: Articles, reviews, and samples for .NET Developers
Creating Professional Reports using Crystal Report for Visual Studio.NET (Part 1)
by Eric Landes
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 75203/ 175


Editor's Note: The first edition of this article was written by Ajay Varghese.

Our previous walkthrough, Crystal Report for Visual Studio.NET provided an introduction to the usage of Crystal Reports in a web application using Visual Studio.NET.  Moving further, this 3-part walkthrough series is intended to help you implement techniques that can add more power to your Crystal Report files.

The topics covered in this walkthrough include :

- Drill Down reports for interactive reporting

- Charts to display data graphically

- Groups to categorize data

- Conditional formatting to format & Hide/Display sections of a report

- Formulas to calculate/format data

A Drill Down report is interactive, intended to enhance the viewer's experience by initially providing only a summary of the overall information and then allowing the viewer to drill-down to the details of his interest.

In this walkthrough we will create a report using the PUBS database, which initially shows the Stores details.  The viewer can then drill down to view the Book Title details, which can further be drilled down to view the Order details.

Graphically speaking, what we would like to achieve in this walkthrough is the report shown when you click on the link below.

Add Crystal File report
  Click here to view the demo in Flash

In the first part of this series, we will use the Report Expert Wizard to generate the report for us. To do this follow these steps :

1. Add a Crystal Report file into your project.  This should pop up the Crystal Report Gallery window. On this pop up window, leave the ‘Using Report Expert’ option checked and select ‘Drill Down’ from the Choose an Expert section.

The various tabs on the Report Expert window allows you to set all the required options from specifying the data source to setting the chart properties that you need for the report.

Report: Data Tab

Data Tab

2. To set the data source, select OLE-DB (ADO) and specify the database settings to select the PUBS database.


3. Once you have the appropriate database displayed under the current connection, select the SALES, STORE & TITLE tables to be used in the report.


Group Tab

Group Tab

6. The Group tab allows you to create the required groups to categorize the data. Note that it is based on these groups that you get additional sections on the report which can be manipulated to work as the drill-down sections. The order in which you select the fields to be grouped by also matters.  Create two groups by specifying Store Name first and then the Title Id.


Total Tab

Total Tab

7.  The Total tab allows you to specify the field to summarize on, for each of the groups. There are numerous Summay Types to choose from. For the sake of simplicity, we will stick to the default which is Sum

Drill Tab

Drill Tab

8. The Drill tab is where you can specify if you want to hide any of the sections. To make only the Store details visible initially you would want to hide the rest of the sections.  Just click on second section (titles.title) and you will notice that the section on which you clicked and the ones below it are now hidden.

Chart Tab

Chart Tab

The Chart tab allows you to specify the chart details that should appear on the report.  A chart inserted into the drill down report will be plotted using the dynamic data from the data source and provides clickable areas which can be used to drill down.  All this is taken care in the background by the Crystal Report Engine.  Notice that this tab contains additional tabs (Type, Data and Text)


Type Tab

9.  The Type tab allows you to specify the type of chart to be included into the report.  Select Pie Chart.


          Data Tab

10.  The Data tab allows you to specify the data that would be used to generate the chart.  As we would like this chart to appear only once in the Report to reflect the Stores data, stick to the default selections as shown in the screen snap shot.

Finishing the Report

11.  You could skip the other tabs for the time being and click finish

You should see the Crystal Report Designer containing all the field names placed into the Page Header, and Field values being placed into the Detail section.  Each Group Header and Footer contains the name of the Group.  You would also notice that the Group 2 Header, Detail Section and Group 2 Footer sections are shaded. The shading implies that these sections are initially hidden and can be viewed only by drilling down to it.

12.  Create a Web Form, place a Crystal Report Viewer control, set its report source to the Crystal Report file and view the report in a browser.  (You can find the detailed steps to achieve in the previous walkthrough - Crystal Report for Visual Studio.NET)

Click here to view how the report should look like in a browser

In the first part of this walkthrough, you have created a Crystal Report file using the Report Expert wizard.  Well … I agree it doesn’t look exactly like the report that was shown at the beginning of this walkthrough.  In the second part, we will take a look at how to modify this report to reflect the actual format that we had in mind earlier.

Crystal Resources

Crystal Alliance

Submitted by

Ajay Varghese & Shankar N.S

Sr. Software Engineers

Jarvis Infotech

Product Spotlight
Product Spotlight 

©Copyright 1998-2021  |  Page Processed at 2021-01-16 7:21:30 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search