Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

3.27 Advanced Tutorials Intro

Advanced Tutorials

As you learned throughout this chapter, Crystal Reports gives you many options for grouping report data and customizing the output. It will probably take some practice before you become familiar with the different ways each option can be used. As you learn more about each option, you’ll discover new ways of creating advanced reports that use these features to the fullest. The following advanced tutorials present you with common challenges that many people on the internet report having trouble with. By walking through these tutorials you’ll become more experienced with the grouping and sorting features of Crystal Reports. When the time comes where you need to create a similar report for your own project, you’ll already know how to design it.

The first challenge you might encounter is with creating dynamic groups within a report. There are times when two reports are identical except for how they group data. Rather than create two different reports, it would be much easier to use the same report and just switch out the group fields.

Another example of dynamic grouping is letting the user choose the field that they want to group on. It would be much nicer to prompt the user with a parameter and then use that parameter for selecting which group to display.

In the next figure we see a report that has two groups. It groups by Country and then groups by Product Type. This report shows how many products were sold within each country.


If you want to change this report to only show sales by Product Type, you can suppress the Country group. This is easy enough to do by right-clicking on the group name and selecting Suppress. But even so, the report still looks very similar to the original report.


You can see that the Competition product type heading is duplicated because in the original report it was spread across multiple countries. It is still spread across multiple countries, but now the group headings aren’t visible. If this were truly a report that only grouped on Product Type, each product type would be consolidated into its own group. There would only be one Group Header for each Product Type. We need to fix this report so that it can be used to either show both groups or just the Product Type grouping.

The typical method of creating a group is to use a database field as the grouping field. But this locks you into a single group field and doesn’t give you any flexibility. An alternative which gives you more options is to create a formula that points to the database field and base the group on that formula. Doing this lets you change the formula field and the group automatically changes as well.