How to conditionally format fields using the Highlighting Expert in Crystal Report

By | May 30, 2023

In the Sage X3, we have various standard reports for almost every screen which are developed in Crystal Report. Also we can develop customized reports as per client‘s need. Crystal Reports is a popular Windows-based report writer solution that allows a developer to create reports and dashboards from a variety of data sources with a minimum of code to write.

One of our client wanted to highlight the lines in the Sales Order report which are having values greater than 10,000. To achieve this requirement, we have used Highlighting Expert feature of Crystal Report, which highlights one or more fields or the whole section based on a particular condition.

We’ve created a DEMO report and highlighted the field ‘Total’ with red color and the whole section with silver when the ‘total including tax’ field exceeds the value greater than or equal to
10,000. Follow the below steps to achive above task :

Step 1:
Select a field to be highlighted (Total Including Tax)

Step 2:
Highlighting button on the Expert Tools toolbar

New Stuff: How to increase or decrease the number of lines in grid of any Inquiry screen

Expert Tools toolbar
Expert Tools toolbar

Step 3:
In the Item editor area, click the Value of list and select the field that you want to base your condition on.
The field chosen here is the field upon which your condition is based; this field need not be the field that is being formatted. To create a condition based on the values of the field that is being formatted, select “this field” from the list. To base your condition on a different report field, select it from the list of available fields.

Step 4:
Select a comparison from the second list (is equal to, is less than, and so on).

Step 5:
Complete the condition by entering the desired value in the box.

Step 6:
In the Font style, Font color, Background, and Border lists, specify the formatting changes that you want to apply to the selected field when your condition is met.

Highlight expert
Highlight expert

Step 7:
Click OK to return to your report.

Also, we can change the backgroud color based on conditions of any particular section by writing the condition on formula workshop :

Step 1:
Right Click on the detail section and select ‘Color’ tab.

Section Expert
Section Expert

Step 2:
Click on the conditional formula button and write the condition as per requirement

Formula Workshop
Formula Workshop

Step 3:
Click on save and close button.

Output
Output

As we can see, lines which are having values greater than 10,000 in Total Excluding Tax are getting highlighted in Red color and having background of Grey color. But the other remaining values are not getting highlighted and background color for those values is white.

So it is working properly as per the condition we have applied in the Formula workshop and Highlighting expert.