A number of clients wanted to apply dynamic conditional formatting to their cross tab sales reports.
Crystal Reports has a couple of cross-tab function, which came in from version 2008, which allows users to apply conditional formatting.
To Apply Dynamic Conditional Formatting to Cross-tabs:- Create a New Blank Report
- Select the Xtreme.mdb database
- Add the Employees and Orders tables to the report
- Use a text object to add the report Header "Employee Orders Xtab"
- Add a Cross tab object to the Report Header section
- Go to the Insert Menu and Cross tab
- Right click on the Cross tab object and select the Cross-Tab Expert menu option
- Add the following fields to the sections of the cross tab:
- Columns: Employee.Employee ID
- Rows: Orders.Order Date
- Summarised Fields: Orders.Order Amount
Orders.Order ID
- Select the Employee.Employee ID field in the Columns section
- Press the Group Options button
- Select the Options Tab
- Check the Customise Group Name Fields
- Select Use Formula as Group Name
- Press the x+2 button
- Enter the formula:
{Employee.First Name} &" "& {Employee.Last Name}
- Press the Save and Close button
- Press the OK button
- Select the Sum of Orders.Order ID field, in the Summarised Fields section
- Press the Change Summary button
- In the Edit Summary dialog box, select Count from the Calculate this summary drop down
- Press the OK button
- Click on the Customize Style Tab
- Set the following formatting options for the cross tab:
- Select Repeat Row Labels
- Select Keep Columns Together
- Deselect Column Totals on Top
- Deselect Row Totals on Left
- Press the OK button
- On the Field Explorer, right click on Parameter Fields
- Select the New option
- In the Create New Parameter dialog box:
- Name: Sales Qty Target
- Type: Static
- List of Values: Static
- Prompt Text: Enter Sales Qty Target
- Default Value: 30
- Press the OK button
- Create a new parameter:
- In the Create New Parameter dialog box:
- Name: Find Employee
- Type: Dynamic
- Value: Employee ID
- Description Last Name
- Parameters: Click -> ?Find Employee
- Prompt Text: Select the required Employee
- Allow Multiple Values: True
- Press the OK button
- Right click on the Summary cell, Count of Orders.Order ID
- Select the Format Field menu option:
- In the Format Editor dialog box, click on the Border tab
- Press the conditional format button for the Color - Background option:
- In the Formula Workshop, enter the following formula:
IF CurrentFieldValue > {?Sales Qty Target} then CrLime Else CrNoColor
- Press the Save and Close button
- Right click on the Summary cell Sum of Orders.Order Amount
- Select the Format Field menu option
- In the Format Editor dialog box, click on the Font tab
- Press the conditional format (x+2) button for the Color
- In the Formula Workshop, enter the following formula:
if GridRowColumnValue ("Employee.Employee ID") ={?Find Employee} then crSilver
- Press the Save and Close button
- Run the Report
If you have any questions, leave us a comment below, or need any assistance, please do not hesitate to Contact Us |