Thursday, August 6, 2009

Crystal Report– Showing Check Box’s On Crystal Reports

Crystal Report– Showing Check Box’s On Crystal Reports

One of the most important things I have learned with Crystal Reports is that many times you need to “think outside of the box”. Crystal has support for Boolean operators to be displayed as the following:

True or False

T or F

Yes Or No

Y or N

1 or 0

Crystal Reports does not have built in support to display a check box for Boolean operators, but with a little creativity and the Wing Ding font, this task can be easily accomplished.

The following example will illustrate how to use check boxes to replace true/false statements in the “Discontinued” field. The simplest way to accomplish this task is to change the display string of the value, and then set the font of the object to Wing Ding.

First a formula will need to be added to change the display text of the field. Right click on the Boolean field you would like to change, and select “Format Expert”. On the Common tab, click the X+Y button for the “Display String” option.

Figure 1: Format editor display string

Ensure that “Crystal Syntax” is selected and copy the following formula:

Figure 2: Changing the display string

The character code 0xFE in the Wing Ding font represents a box with check mark. In contrast, the character code 0xA8 represents an empty box.

The Character Map tool, which can be found in the Accessories folder in the Windows Start menu, will assist you in discovering the hex values for character codes of the items you would like to display.

After you have found the character code for the value you would like to display, add it to your formula. It is much simpler to use the decimal representation of the ASCII value instead of the hex value.

This is a great site to find all of the ASCII values, including their hex and decimal representations. After you have set your formula, make sure you set the font for the object to Wing Ding, on the “Format Editor “screen.

Figure 3: The Windows Character Map tool

Figure 4: Report with discontinued check boxes

No comments:

Post a Comment