Skip to Content
Author's profile photo Former Member

Creating CheckBox in Crystal Reports 2008

Sometimes requirement might come where in we need to use check boxes in our reports. This document shows how to create check boxes in Crystal Reports 2008. The eFashion universe is used for the demonstration purpose. Here if the Sales Revenue is more than 10000, we need to check the box otherwise the box will be unchecked. As I earlier said this is just for demonstration purpose, actual requirements can be different. But the procedure of creating the check boxes will remain same as explained:

Steps:

1. Create a simple report using Crystal Reports 2008 as shown:

1.JPG

2. Create a new formula field, say check box.

2.JPG

3. Write following code in the formula field editor.

   If {Agg_yr_qt_mt_mn_wk_rg_cy_sn_sr_qt_ma.Sales_revenue} > 10000

   Then

   Chr(254) Else

   Chr(168);

3.JPG

4. Drag the formula field on the report. The report will look like this:

4.JPG

5. Right click the formula field. Go to the format field option.

5.JPG

6. Go to the tab Font and change the font to WingDings.

6.JPG

7. We have the final report as shown:

7.JPG

Thus the records which have revenue more than 10000 have checked boxes whereas the records with revenue less than 10000 have unchecked boxes. 🙂 🙂 🙂

Assigned Tags

      11 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Creative doc.....

      Author's profile photo Former Member
      Former Member

      ahhh . .. but what happens when you export the report to PDF where the wingdings font is not supported?

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi Mike,

      It works fine when you export to pdf. The check boxes are still there. You can try a simple scenerio as explained above and then export it to pdf. You will see the check boxes there as well.

      Regards,

      Neeraj Sharma

      Author's profile photo Former Member
      Former Member

      Yes! Neeraj is correct,

      it's working fine with "export to pdf" and "printToPrinter" also. I have tried with CR - 2011

      Thanks,

      Nitesh

      Author's profile photo Former Member
      Former Member

      Nic1 Neeraj 🙂

      Author's profile photo Former Member
      Former Member

      How would I add a check box based on Y or N values?

      Also, let's say I have 50 fields with either Y or N value in them, do I need to create a formula for each of the fields?

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi Jack,

      You can write following formula for Y or N values:

      If {Table_Name.Field_name} = "Y"

      Then Chr(254)

      Else Chr(168);

      For your second question, I don't find any other way i.e. you need to create a formula for each field.

      Regards,

      Neeraj Sharma

      Author's profile photo Former Member
      Former Member

      Hi Neeraj,

      Yes I wrote the formula before you wrote back and it worked like a charm. I just hoped that I could consolidate all of the fields into one formula and be done with it.

      Thank you very much for the document you've created.

      Cheers.

      Author's profile photo Former Member
      Former Member

      That would be a nice feature:

      File > Options > Fields > Boolean... > Boolean

      - Add a cusomized text option instead of just the static list.

      I am using CR 2008

      Author's profile photo Former Member
      Former Member

      Keep it coming. Nice tips 🙂

      Author's profile photo mohd Arif
      mohd Arif

      It very good for learning purpose.