Business Intelligence

Check, mate: Creating a checkbox in Crystal Reports

Museum checklists and databases use boolean values, but, currently, there is no way to graphically represent this information in Crystal Reports. Here’s a quick work around to display checkboxes. In this example we will create a graphical checkbox to display if the object record is set for public access.

In this example, we will create a graphical checkbox that displays when the object record has public access selected. This technique is included in Advanced Crystal Reports, which was presented at Collective Imagination 2009.

Crystal Reports

Select “Add New Formula” under the Formula Fields section of the Field Explorer.

Name your field whatever you want, in this case: checkbox_publicAccess.

Edit the formula. You can utilize any field that you desire, and set the operator as any criteria that meets your individual needs, however the outcome must be either CHR(254) or CHR(168). Our example uses the following:

1
IF {Objects.PublicAccess= 1 THEN CHR(254ELSE CHR(168)

Insert {@checkbox_publicAccess} into your report. Select “Format Field” from the right-click menu. In the dialogue, change the font to Wingdings, and adjust the size and weight to your needs.

Crystal Reports Format Field Dialogue

Voila, now your report displays a boolean value as a graphical checkbox. If your computer does not have the Wingdings font, you can download a copy from Fonts.com

Thanks for taking the time to read my post – I hope you found it helpful.
Leave feedback in the comments below.

If this post save you time, then consider sharing it with your friends and colleagues. If it saved you some money, then please consider buying me a coffee. If you want to know when I publish new content, then subscribe to my feed. Your support encourages me to write more. Thanks!

Check, mate: Creating a checkbox in Crystal Reports

One Comment

  1. This post was updated to correct some errors in the syntax. If the checkboxes aren’t quite your flavor, consider these possibilities:

    CHR(254) – displays a box with a check mark
    CHR(253) – displays a box with an X
    CHR(111) – displays an empty box
    CHR(168) – displays an empty box
    CHR(252) – displays a check mark only
    CHR(251) – displays an X only

Leave a Comment