|
|||||||||
|
Crystal Reports Tools: Improve Performance While Saving Time and Money |
|
Crystal Reports: Consolidating GroupsSometimes in a drill down or summary report, a group is required to create the right sort sequence, but no sub-totaling or printing is needed. Drill down reports, with nothing in a section, are difficult to drill down to lower levels.The solution is to create a formula to combine several fields into one group. This is quite easy to accomplish if they are all of the same data type. String fields are easy to combine together this way. You do have a problem if there are number or dates fields in the group. In that case use the Totext function to ensure that everything is matched up as a string. Remember to use a yyyy/MM/dd format if you want to use a date field in the correct sort sequence. Here's some other insight on groups: he Group Expert is a quick way to see what fields you are using for groups in your report. It also provides an easy way to shuffle the groups around into the sequence you require. One feature we like (in CR9 and above) is you can "undo” after you have used “delete group.”
Steve Dowse from Business Objects in Sydney reminded us that (with Crystal Reports 9.0 and above) you can group on the same field more than once. This lets you use a field for specified order and then within that group you can group by individual values of the fields. Earlier version users need to create a formula that uses the group field. You then could group on the formula. You can group on pages Using groups in a report is one of the major strengths of Crystal Reports. Creating the right groups and using them effectively is one of the skills you quickly develop. Use the group header, and display the group name and other fields to identify the group. It can also be useful to move the column headings from the Page Header to the Group Header section. But what if you have a large group that flows over to a subsequent page? How do you control the report so the headings re-appear on each page as the group continues? When you create the group, select the option "Repeat Group Header on Each Page." This will cause the group header to appear on each new page. If you have forgotten to set this, you can change an existing group, and set it later when you need to. Here's another tip on this subject: Display “Continued” when a group continues onto a new page. It can also be useful to display the word “Continued” when then the group header is not the start of the group. Place this formula in the group header section: If InRepeatedGroupHeader then “Continued”
On a related topic, you can also group by field. You can group by the same field more than once. This could be useful if you have used Specified Order for the higher level group, or the report is TopN and you would like the "Others" group to show totals by the original field at the next level down. However if you use that summary in a formula, interesting things happen. The summary is referred to in the formula as
There is nothing in that formula to distinguish which of the two levels summaries you want. So the formula will always display the higher level total. This means you can’t use the lower level summary in that form in the report. If you want the lower level summary in a formula you will need to create a formula to calculate the original group field. Then create the lower level group by the formula rather than the field. You can use this summary in a formula. We have a sample report to demonstrate this available from our web site to illustrate this. Grouping by a field more than once is available in Crystal Reports versions 9, 10 and XI. Crystal Reports 8.5 and earlier will not allow you to create a group if the field is already used for grouping. However, our formula field solution lets you group by a field more than once for any version of Crystal Reports. And the summaries don’t get confused when you use them in formulas. Parameters, not pages Nothing says you have to group on pages. You can group on parameters, instead. Sometimes, we get a request for the same Crystal Report grouped in two or more different ways. One solution is to create different reports, but then any subsequent modifications have to be done to each rpt file. Another way is to let the user select the group by using a parameter and some clever formulas. If our report has a parameter to select the group of City or Region, the formula for Group1 would be: If {?Group}="Region" then {Customer.Region} else {Customer.City} You could write similar formulas to control optional headings and the first column in your report.
This article is copyrighted by Crystalkeen, Mindconnection, and Chelsea Technologies Ltd. It may be freely copied and distributed as long as the original copyright is displayed and no modifications are made to this material. Extracts are permitted. The names Crystal Reports and Seagate Info are trademarks owned by Business Objects. |