Skip to main content

Yes, No, or is it Null?

Overview

In Crystal reports, take into account null values as the answer for Yes or No questions. 

Details

When creating Crystal Reports, there are times when a checked box is used to symbolize a ‘Yes’ or ‘No’ answer to a question from a form in TIER. Depending on how the form is set up, the user is expected to select either a ‘Yes’ or ‘No’ option button. However, if the answer is not required, the user can and will sometimes skip entering an answer. When printing this information in a report, the code will need to handle nulls as an answer as well.

The following example shows how to check for nulls.

The ASCII Character, chr(254), represents a box symbol with a check mark:             image001.png      

The ASCII Character, chr(168), represents a box symbol without a check mark:      image003.png

Code:

if{FD__TIER_ASSESSMENT.Ans1}=0 then chr(254) else chr(168)

Report:

image005.png

Here is the rewritten example of where the code is checking for nulls.

If no data is entered, nulls will be symbolized with a box without a check mark.

 Code:

if isnull({FD__TIER_ASSESSMENT.Ans1}) then chr(168) else

if {FD__TIER_ASSESSMENT.Ans1}=0 then chr(254) else chr(168)

Report:

image007.png

Make sure when giving the option to users to select either a ‘Yes’ or ‘No’, that nulls are taken into consideration and the answers to the questions are not misrepresented on the report.