TopNGroup Sorting

TopN/Group Sorting is a function of Crystal Reports used to sort groups according to a summary field that has been created based on that group. This function is often used to determine something like the top 20 customers (that is, Top N, where N is 20) or the top or bottom five products, and it can also be used to order groups based on a summary field. Before you can use TopN/Group Sorting in your report, you need to make sure that you have two things inserted onto your report: a group and a summary field. Without both of these present, you cannot use TopN/Group Sorting.

To add TopN/Group Sorting to your report, verify that your report has at least one group and one summary inserted, and then right-click a blank area of your report and select Report ^ TopN/Sort Group Expert to open the dialog shown in Figure 3-18.

Figure 3-18

Using the drop-down list at the top of the dialog, select the type of analysis you want to perform from the following list:

□ All (for placing the groups in order by a particular summary field value)

□ Top Percentage

□ Bottom Percentage

By default, the other groups in your report are included in a group called Others. If a group is not included in the Top (or Bottom) N or the percentage you specify, it will get lumped into this group. To suppress this function, click the check box at the bottom of the dialog. If you would like to keep the Others group but just change the name of the group, you can enter a new name in the text box beside the Include Others box. Click OK to accept your changes and to apply these changes to your report.

In the report we have been working through in this chapter, apply TopN analysis to get the Top 10 customers based on the Order Amount field and discard the Others. Your report should now only show the first 10 customers, as shown in Figure 3-19.

You can also use this type of analysis to sort the groups in your report according to some summary field that you have inserted in your report. This functionality is similar to TopN analysis, except that it isn't limited to just a certain number of groups. To sort the groups in your report by the value of a summary field, repeat the same process we just went through, but instead of selecting TopN, choose the option for All, and your groups will be ordered by the summary field you select.


Q i Psycho-Cycle

Q Crank Components

Q Hooked on Helmets

Q The Great Bike Shop

Q Blazing Saddles

Q Tienda de Bicicletas

Q Tandem Cycle

Q Sporting Wheels Inc.

Q Canal City Cycle ilà

MainReport |

L'u-HIH Kim


Was this article helpful?

0 0

Post a comment