Question: I often need to display Boolean data on my reports, but am looking at other ways to represent this other than just “True” or “False.” Is it possible to do this – for example, could it be set up to display check boxes instead?
Answer: Yes, it is often required to display Boolean values on a Crystal Report, and it is reasonably straightforward to provide a more intuitive display, such as check boxes either checked or unchecked, rather than the standard “True/False” rendering. This can be achieved by using a little imagination and the Crystal formula language. Without this solution, the display of the Boolean value is as follows:
This example is going to use the Xtreme sample database and we are going to set the check box on the “Shipped” column. How do we do this? First, we set up a formula to evaluate the Shipped Boolean value and assign the appropriate character symbol for a ticked check box if the value is true and a crossed check box if it is false. The formula is listed below:
We then place this formula onto the report – removing the Shipped report field. Once the field is on the report, we just need one more step – that is to use the format editor to set the font to “Wingdings” so that the character is rendered properly. (As an added bonus, the format editor was used to change the color of the font based upon the same condition as is in the formula to make the display even clearer to the person viewing the report).
Of course, this solution will allow you to use any number of different character representations for your data using any of the supported symbol fonts. One good reference to determine which “chr()” value to use is at this site – http://cloford.com/resources/charcodes/symbols.htm