Crystal Reports in the Real WorldGroup on a Formula


Sometimes when creating a report, the development database might not be complete or might be in production; there might be a requirement to group elements based on some criteria that is not in the database. In these cases, it can be useful to group on a formula. To explore the benefits of grouping on formulas, follow theses steps:

1.

Open the sample report from Chapter 1 (Chap1Manual.rpt). Create a new formula and name it Continent and click the Use Editor button.

2.

Type the following text into the code window so it appears like Figure 2.21:

WhileReadingRecords; Select {Customer.Country}     Case "Canada", "Mexico", "USA":         "North America"     Default:         "Outside North America";


Figure 2.21. A sample formula to group information on a formula.


3.

With the text entered, click the Save And Close button.

4.

From the Report menu, select Group Expert. Find the Group1 formula from the list of Available Fields and add it to the list of Group By fields. Finally, because the Group1 field is a higher level than the For Country field, select it and move it up using the arrow button. The results are displayed in Figure 2.22.



Figure 2.22. The report correctly grouped, highlighting the capability to group on formulas and create increasingly flexible reports.


5.

Click OK to see the completed report that looks like that presented in Figure 2.23.

Figure 2.23. A report with a group based on a formula highlights the powerful capabilities of custom grouping.


 




Crystal Reports XI(c) Official Guide
Crystal Reports XI Official Guide
ISBN: 0672329174
EAN: 2147483647
Year: N/A
Pages: 365

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net