Tutorial 13-3. Customizing the Cross-Tab Layout.
The summary fields within most cross-tab reports show all the data as looking the same. This has the benefit of consistently producing a professional looking report each time. But in a large cross-tab report, it can sometimes be difficult to spot important information among the many pages of data. In this circumstance, it helps to customize the look of the individual fields within the cross-tab. By associating a summary field with a formula, important cross-tab data is emphasized so it is easy to find.
In this tutorial, we will change the formatting of data that falls outside of a valid range. We will modify the total order amount for each product by highlighting products with less than $1,000 worth of sales. This alerts the manager that they need to either market the product better or discontinue it altogether.
- Open the CrossTab.rpt sample report that was installed with Crystal Reports. Save it as CrossTab Highlight Sales.rpt.
- Make sure you are on the Design tab and right-click on the Sum Of Orders.Order Amount field.
- Select Format Field from the pop-up menu. This opens the Format Editor dialog box.
- Click on the Font tab and you’ll see that the Style property is set to Bold. We want to change this to Regular so that only the fields that are under $1,000 are emphasized. Click on the drop-down box and change Bold to Regular.
Now we are going to create the formula which checks the summary field’s value and if it is less than $1,000, we add highlighting to it.
- For the Style property, click on the Formula Workshop button next to it to create a new formula. Enter the following formula:
If CurrentFieldValue < 1000 then
crBold
Else
DefaultAttribute
This formula compares the current field's value to $1,000. If it is less, then the Style is set to Bold. If not, then the Style is left as its default attribute (regular).
- Click the Save and Close button to close the Formula Workshop. Then click the OK button to close the Format Editor dialog box.
The other summary field, Percentage of Others, has a default Style of Bold and we want to change it to Regular so that it matches the format of the order total summary field.
- Right-click on the Percentage of Others summary field and select Format Field from the pop-up menu.
- Click on the Font tab and change the Style property to Regular.
- Click the OK button to save your change.
- Preview the report to see what it looks like.
The report shows three summary fields that are less than $1,000 and they are also bold. This lets the reader immediately notice which products should be reviewed for poor monthly sales.