How to Add check box in Birt Report DEsigner

Hi i would like to know how to add checkbox in birt report designer.
i have added checkbox in maximo when i call the field in report it show 1 and 0 i want to display check box .

Answers

  • wwilliamswwilliams Junior Member

    This displays a checkbox and if the parameter is = 1 the checkbox is checked
    <form name="tasks"> <input type="checkbox" name="taskcheckbox" <VALUE-OF>if( params["checkit"].value==1){ "checked"; }else{ ""; }</VALUE-OF>>Task Complete</input> </form>

    I re-purposed some code from Jason Weathersby

  • wwilliamswwilliams Junior Member

    I guess the check boxes don't work when you convert to a PDF and I am guessing that is what you would want. I think it would be a pain, but you could create two image files and control visibility dynamically.

  • edited June 28, 2018

    You beat me to the answer, wwilliams. I'll attach the example I created anyway and list the steps I followed:
    :
    1. Create a computed column in the data set to randomly generate Boolean values (just for testing).
    2. Create a second computed column in the data set to generate the checkbox state.
    3. Add a table to display the computed columns.
    4. Replace the second Data element in the table with a Text element.
    5. Change the Text element type to HTML and add HTML code to display a checkbox.
    6. Insert the row value containing the checkbox state in the HTML using the tag.

    An HTML tag will be generated for each row of the table and the computed state for that row will be inserted into the tag to set the box's checked state to the Boolean value.

    I don't think PDF's support functional checkboxes, and the emitter would need to support them as well, so this is just for web. Even for web, it isn't a functioning form. This is just a report.

    Jeff F.
    Customer Support Engineer I
    OpenText
  • Thanks guys i have got a solution which is very easy please see below.

    if(dataSetRow["Fieldname"]=="1")
    {
    String.fromCharCode(10003);
    }
    else
    {
    String.fromCharCode(10065);
    }

  • That's a great solution! Thanks for sharing it.

    Jeff F.
    Customer Support Engineer I
    OpenText
  • Hi Please check this is PDF conversion screenshot.

  • Hi,
    I have tried this solution but Checkbox is not working in PDF Export, Please find the attachment. Could you please help me to resolve this.

    Thanks,
    Bose

  • wwilliamswwilliams Junior Member

    I only have 3.7.1 so I edited the xml from your report so I could run. So it is version related?

  • I tested running the checkbox report and outputting to PDF on version 4.8. The symbols displayed correctly.

    Jeff F.
    Customer Support Engineer I
    OpenText
  • Hi Jeff,

    I have modified the version to 4.8 in the xml but it is not working, I got error "org.eclipse.birt.report.exception.ViewerException: There is no report design object available." . After that I downloaded eclipse 4.8 version then try the same report (version="3.2.23") then there is no error but Checkbox is not displayed on exported PDF file. Please help me if it is working in latest version, then how can I modify the older .rptdesign file.

    Please find the attachment.

  • Hi,

    First, I recommend against modifying the XML for any reason.

    Regarding the new report, it displays correctly as a PDF for me. Here is a screenshot that includes the font settings:

    I would expect the fonts to be the same, but maybe something related to your environment is affecting them.

    Jeff F.
    Customer Support Engineer I
    OpenText
  • Hi,

    Sorry, I am not getting your point. as per design font is Sans Serif. Where can I need to modify?

  • When I look at the same property on your report, I see "serif", not "sans serif". I tested both fonts as well as some others I selected at random. They all render the check boxes correctly in PDF for me.

    What do you see for the fonts in your PDF viewer?

    Jeff F.
    Customer Support Engineer I
    OpenText
  • I have free Acrobat Reader DC, it can be view the PDF file only, not able to edit. there I can't see the font option which is mentioned earlier in the screen shot.

    How do I resolve the issue?

  • My testing shows that the BIRT Designer is evaluating the characters in question correctly, I am testing with an out-of-the-box Designer. I did not need to change any configuration settings to render the characters in PDF. This points to an issue with your environment.

    As a workaround, you could try a different code and see if displays correctly. For example,

    Replace:

    String.fromCharCode(10003);

    With:

    "\u2714"

    Jeff F.
    Customer Support Engineer I
    OpenText
Sign In or Register to comment.