Saturday, July 18, 2009

Printing checkbox in crystal report for boolean column using formula feild in asp.net website - Chr(254) , Chr(168) , windings, asp.net , c#.net

Here is a small description of how to print a checkbox in crystal reports. If the value of the boolean field is false then uncheck the checkbox if value is true then check the check the checkbox. For this in simple words Create a Formula fields with your boolean column name and note that Char(254) is for true value and Char(168)is for false value. Here is the example formulla If {Table.BitF} = true then Chr(254) else Chr(168) Event Management Software Visitor Management Solution ID Card Software Now place the formula in your report designer and change font to Wingdings. You are all set. From my experience i know the now almost all the organisations using crystal reports for reporting. And to represent a boolean field crystal reports are not providing checkbox control by default. We need to write formula for bringing checkboxes into crystal reports. Here i am going to give a step by step description for "How to bring checkboxes into crystal reports". One thing i am using asp.net for this article. First add a dataset into your website/Project For adding a dataset into your project right click on your solution explorer and select add new item. Then the form will look like this Select dataset. And click add then a messagebox will ask whether you like to place it in app_Code folder. Click yes. Nou you right click the form and select add datatable. Now you right click on the top of the datatable and select add column. Now you rename the column as you wish. Next you have to select the properties of thh column and select the datatype as system.Boolean. As demonstrated in the following image. And you can add another columns as you like. Now we need a crystal report into the solution. For adding new crystal report into the solution right click on the solution add new item and select crystal report. Click add. just click ok for the popup comming. Then select the datasource for crystal report as below Select the datatable added then click ">" Next button Now you select formula fields->New->Give a name->Use Editor Add the formula like in the image. Add the fields into the report. And change the field font to windings of the formula field. Then take the preview. Hope You understood what i put into this........... Happy Programming

4 comments:

  1. I want a check box dynamically but its should be showing if data not there then check box showing cross mark and is data is there so its showing tick mark.Please give me a solution for this prob.

    ReplyDelete
  2. hi, what if the we store 0 or 1 in the database instead of true and false?

    ReplyDelete
  3. what happens when you export the report to a program not supporting that wingdings font, like pdf?

    ReplyDelete
  4. Chr(254) else Chr(168) is not Display in Mozilla Fire fox

    ReplyDelete