One of the powerful features of Crystal Reports is the great
amount of flexibility you have as a report developer in grouping your data.
Once you can group your data you can sum, count, average, perform standard
deviation, variance, and a host of other operations on your data. Grouping
data in a SQL statement can be problematic because you can only include the
fields you're grouping on in your select statement. Crystal Reports does not
have this limitation.
Crystal also has a feature for hierarchy grouping for
situations where you have nested groups and you don't know how many levels of
grouping there are. This article will show you how to create a report with
simple grouping and summation fields and will also create a report using the
hierarchy grouping feature.
Before you begin you will need to have installed Visual
Studio 2010. Crystal Reports is no longer distributed with Visual Studio and is
available as a separate download. You can download Crystal Reports here. You
also will need to download the AdventureWorks sample database from here. Once
you've installed the database you need to create a SQL Login that the application
can use to connect to the database. My sample code expects a SQL Login to be
called "aspalliance" and the password should be set to
"aspalliance". The sample code for this application can be downloaded