Let's work through an example for the Xtreme Mountain Bike Companythe fictitious company that corresponds to the sample database provided with Crystal Reports.
Xtreme management needs a summary report to provide a quick glance at its shipped orders. The managers want to know how much has been spent by country for every six-month period, but they only want to see the top 10 countries. The following steps show you how to create this report:
- Create a new report by choosing File, New and when the Report Gallery appears, choose As a Blank Report and then click OK.
- The Database Expert appears. In the Available Data Sources list, expand the following nodes: Create New Connection, ODBC. Select the Extreme Sample database 10, click Next, and then click Finish.
- Expand Tables, and double-click on Customer and Orders. Click OK.
- The Database Expert dialog appears again. Click OK again to accept the default linking.
- Insert a cross-tab by choosing Cross-Tab from the Insert menu, or click the Insert Cross-Tab button on the Insert toolbar (the fourth item from the left). This should present the Cross-Tab Expert dialog.
- Set up the initial cross-tab. In the Cross-Tab tab of the Cross-Tab Expert, enter the grouping and summarizing fields for the Xtreme report. The rows of the report are the countries, so select Country from the Available Fields and then click the arrow button (>) under Rows. The column grouping is going to be by order data, so choose Order Date from Available Fields and then click the arrow button (>) under Columns. Because the OrderDate is supposed to be by quarter, click on the Group Options drop-down under Columns and change the third list box from Each Day to For Half Year. Finally, choose Order Amount from Available Fields and click the arrow button (>) under Summarized Fields so that the cell's summary is also selected. The final result looks like Figure 10.3.
Figure 10.3. Cross-Tab ExpertCross-Tab tab.
- Data input is practically done. Now that you've specified the necessary items, click the OK button to close the Cross-Tab Expert. Then place the object connected to your mouse in the top-left corner of the Report Header section. Press F5 to refresh the report and see the result in the report Preview as shown in Figure 10.4.
Figure 10.4. Cross-tab in Preview.
- Before continuing, save your work. Choose File, Save As. Call this cross-tab1.rpt and then click OK.