Search code examples
jasper-reports

How to add custom row in Jaspersoft?


I tried to create a report with Jaspersoft Studio following this tutorial. And I have created a table like that:

enter image description here

But I don't know how to add a custom row to below this table like that.

enter image description here


Solution

  • Your report is made up of 3 areas.
    1) Header Band(group header, page header, report header)
    2) Detail Band
    3) Footer Band(group footer, page footer, report footer)

    enter image description here

    If you want to add total area, you should add footer band and create variable for calculate total amount.

    <variable name="TOTAL_AMOUNT" class="java.math.BigDecimal" resetType="Group" resetGroup="Your Group Name" calculation="Sum">
        <variableExpression><![CDATA[$F{AMOUNT}]]></variableExpression>
    </variable>
    

    And put textField at footer band

    <textFieldExpression class="java.math.BigDecimal"><![CDATA[$V{TOTAL_AMOUNT}]]></textFieldExpression>