Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

5.13 Using the Highlighting Expert

Using the Highlighting Expert

The Highlighting Expert is a simplified version of the Formula Workshop. If you’re having a tough time learning how to use the Formula Workshop, you can use the Highlighting Expert until you get more experience with formulas. However, it has limitations on what you can modify. It only lets you modify the font and border properties. Figure 5-11 shows you what the Highlighting Expert looks like.



Figure 5-11. The Highlighting Expert dialog box.

To open the Highlighting Expert, right-click on the field you want to format and select Highlighting Expert. The left side of the dialog box is the Item List. It lists the formatting rules you created. The left column, Sample, shows an example of what the formatting changes will look like when applied. The right column, Condition, shows the formula. As you add new formulas, they get added to this list.

The right side is the Item Editor where you create new formatting rules. This is similar to the Select Expert in that you choose the field you want to base the condition on, select the value and the type of condition to compare it to (Is Less Than, Is Greater Than, etc.). One thing you will notice is that the list of comparisons is significantly smaller than the ones listed in the Select Expert. This is because you can only use discrete values. The Highlighting Expert doesn’t let you build conditions using range values or a list of values.

The bottom portion of the Item Editor is where you select the formatting that is applied if the condition is met. You can set the font style, color, border, etc. The Sample box at the bottom also shows you an example of what the formatting looks like.

An interesting aspect of the Highlighting Expert is that the formulas in the Item List are cumulative. If a field matches more than one condition, both formatting rules are applied to it. For example, let’s say that one rule changes the border and the other rule changes the font color. If the data in a field matches both conditions then it will have both its border and font changed. In some circumstances, the two rules might conflict with each other. For example, they both might set the font to be a different color. Crystal Reports resolves rule conflicts by starting at the bottom of the list and works its way up. Rules at the top of list always override the rules below.

I don’t recommend using the Highlighting Expert. Yes, it is an easy way to do conditional formatting, but it has some drawbacks. The first drawback, as mentioned earlier, is that you are limited to only changing the font and border of an object. But there are two much larger problems. The formatting changes made in the Highlighting Expert are stored behind the scenes in hidden formulas. They aren’t listed in the Formula Workshop. The Formula Workshop is the “Command Center” for doing all conditional formatting and not having a formula listed there makes it easily forgotten. The other problem is that the formulas created by the Highlighting Expert override the formulas in the Formula Workshop. So not only are these formulas hidden, but they take precedence over the other formulas that you can see.

Consider the following scenario: One of your co-workers left their job and you are now in charge of maintaining their reports. You add some conditional formatting formulas to modify the sales field. When you run the report most of the rows look as expected, but some of them don’t have the correct formatting. You go back to debug your formula, but you get frustrated when it appears that your changes don’t have any affect. Then it occurs to you: Check the Highlighting Expert! Sure enough, the person who built the report had some rules hidden in the Highlighting Expert and that is overriding your changes. You delete these rules and add them back using the Formula Workshop so that you don’t get surprised again. Everything looks fine now. Unfortunately, you have no idea how many other places the Highlighting Expert was used and the only way to figure this out is to right-click on every report object and open the Highlighting Expert. Sigh…

I recommend taking the extra time to learn how to use the Formula Workshop so you save yourself (and possibly others) from headaches.