The first half of this article discussed creating a Crystal
Report file, including it in your custom .NET application and then getting data
to the report. The steps to accomplish this are not the complicated, but the
report that we are rendering is not that complex either. The great thing about
using a reporting package is the ability to adapt as reporting needs become
more complex. Clients will often nit-pick every detail on reports.
Crystal Reports Processing
One of the most common complains about Crystal Reports is
that reports take a long time to render. The team that created Crystal Reports
has spent a great deal of time in recent versions correcting the performance
issues. That being said, keeping the processing that Crystal Reports performs
on the data to a minimum is still a wise course of action.
For example, Crystal Reports includes functionality to order
records by fields. It is still better to order your data before it gets to the
Crystal Report, since your database server will be able to perform this action
much more quickly than Crystal Reports will.
One of the most powerful features in Crystal Reports is the
ability for your users to export your Crystal Report to over 14 other formats.
Crystal Reports RPT
Microsoft Excel (93-2007)
Microsoft Excel Data-Only (93-2007)
Microsoft Word (93-2007)
Microsoft Word Editable (93-2007)
Record Style-Columns with spaces
Record Style-Columns without spaces
Rich Text Format (RTF)
Separated Values (CSV)
Tab Separated Text (TTX)
It is beneficial to have the ability to export to all these
different formats, but the export feature in Crystal Reports does not export
each format in exactly the same way. This primarily comes from the way that the
developer created the report, and also which format the report is being
exported to. If you decide to allow your users to export your Crystal Report, I
suggest you officially support the export to PDF (they always look exactly like
the RPT file that was generated) and inform the users that the other exports
may render the report a bit differently.
This is not to say that a report can’t be “tweaked” to work
with all of the different export options, but it can be cumbersome to do so.
One of the most commonly used features when creating a
report is grouping similar data together. This is one of the biggest advantages
of using a reporting package such as Crystal Reports. The example in Figure 4
shows the employee data used in other examples grouped by city.
Figure 4: Report grouped by city
To group similar data in Crystal Reports, use the “group”
option, which can be found under insert>group in the Crystal Reports stand
Figure 5: The group menu
You will then be prompted for which fields you would like to
group by. For our example, we will just be grouping by the city field and not
worrying about any other options.
Figure 6: Selecting a field to group the report on
After the group has been created, your report now contains
two more sections: Group Header #1 and Group Footer #2. This allows you to
place data specific to the group in these sections. It is common to place the
field that is being group in the group header.