SAP Knowledge Base Article - Public

1280307 - How to highlight a field in a cross tab based on a condition containing a different field which is not used in the cross tab of Crystal Reports?


  • Need to highlight a field in the cross tab when certain condition is satisfied
  • This condition is based on the fields that may not have been used in the cross tab

Reproducing the Issue

Environment Information:

  •   Crystal Reports Designer XI Release 1 and above


The steps are explained with the help of an example based on the Xtreme sample database.

    1. Create a report and insert a cross tab as mentioned below.
    2. Customer.Customer Name in Rows.
    3. Customer.Customer ID in the Columns.
    4. Customer.Last Year’s Sale in the Summarized Fields.
    5. Note: Need to highlight the customers who belong to the country USA. (Country field is not included in the cross tab).

    6. To achieve this Customer.Country will have to be included in the cross tab.
    7. Create a new formula ‘test’ and Write the following code: Customer.Customer Name}& ' '&{Customer.Country}
    8. Open the cross tab expert and remove the field Customer.Customer Name from rows.
    9. Insert the ‘test’ formula into the rows section of the cross tab.
    10. Now along with Customer name Customer country is also shown in the rows of the cross tab.
    11. Right click the row field and select Format Field from the contextual menu to open Format editor window.
    12. Click on the Font tab and then the formula button (X-2) in front of Color to open the formula workshop.
    13. Write following code to it: if "USA" in CurrentFieldValue then crRed else crNoColor;
    14. Close formula workshop and Format editor.

      Observe that the customer name belonging to the country USA are highlighted by red color.


CR, crosstab , KBA , BI-RA-CR , Crystal Reports designer or BusinessViews Manager , How To


SAP Crystal Reports XI