I have created a table report.
I have put no, agency name, year 1, year 2, year 3, year 4, year 5 and the total for the first row and the second row. I’ve put all sum of year 1, year 2, year 3, year 4, year 5 and total of agencies in the Detail band. After that, I put the line chart layout. In the end, I put the page break with $V{REPORT_COUNT} % 5==0 condition. But the problem is repetitive data along both the row. How to solve this problem? I want to view 5 row per page for an one report. The result are still the same.
Here i attach my code:
Update:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="charttest" language="groovy" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="99"/>
<parameter name="P_YEAR" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["C:\\Documents and Settings\\NT\\Desktop\\CHART\\"]]></defaultValueExpression>
</parameter>
<field name="PARENT_NAME" class="java.lang.String"/>
<field name="PARENT_NAME_SECTOR" class="java.lang.String"/>
<field name="AGENCY_PARENT_CODE" class="java.lang.String"/>
<field name="AGENCY_CODE" class="java.lang.String"/>
<field name="AGENCY_NAME" class="java.lang.String"/>
<field name="YEAR" class="java.math.BigDecimal"/>
<field name="SECTOR_ID" class="java.lang.String"/>
<field name="SECTOR_NAME" class="java.lang.String"/>
<field name="DYEAR1" class="java.math.BigDecimal"/>
<field name="DYEAR2" class="java.math.BigDecimal"/>
<field name="DYEAR3" class="java.math.BigDecimal"/>
<field name="DYEAR4" class="java.math.BigDecimal"/>
<field name="DYEAR5" class="java.lang.String"/>
<field name="YR1" class="java.math.BigDecimal"/>
<field name="YR2" class="java.math.BigDecimal"/>
<field name="YR3" class="java.math.BigDecimal"/>
<field name="YR4" class="java.math.BigDecimal"/>
<field name="YR5" class="java.math.BigDecimal"/>
<variable name="YR1_1" class="java.math.BigDecimal" resetType="Column" calculation="Sum">
<variableExpression><![CDATA[$F{YR1}]]></variableExpression>
</variable>
<variable name="YR2_1" class="java.math.BigDecimal" resetType="Column" calculation="Sum">
<variableExpression><![CDATA[$F{YR2}]]></variableExpression>
</variable>
<variable name="YR3_1" class="java.math.BigDecimal" resetType="Column" calculation="Sum">
<variableExpression><![CDATA[$F{YR3}]]></variableExpression>
</variable>
<variable name="YR4_1" class="java.math.BigDecimal" resetType="Column" calculation="Sum">
<variableExpression><![CDATA[$F{YR4}]]></variableExpression>
</variable>
<variable name="YR5_1" class="java.math.BigDecimal" resetType="Column" calculation="Sum">
<variableExpression><![CDATA[$F{YR5}]]></variableExpression>
</variable>
<variable name="YR1_2" class="java.math.BigDecimal" resetType="Column" calculation="Sum">
<variableExpression><![CDATA[$F{YR1}]]></variableExpression>
</variable>
<variable name="YR2_2" class="java.math.BigDecimal" resetType="Column" calculation="Sum">
<variableExpression><![CDATA[$F{YR2}]]></variableExpression>
</variable>
<variable name="YR3_2" class="java.math.BigDecimal" resetType="Column" calculation="Sum">
<variableExpression><![CDATA[$F{YR3}]]></variableExpression>
</variable>
<variable name="YR4_2" class="java.math.BigDecimal" resetType="Column" calculation="Sum">
<variableExpression><![CDATA[$F{YR4}]]></variableExpression>
</variable>
<variable name="YR5_2" class="java.math.BigDecimal" resetType="Column" calculation="Sum">
<variableExpression><![CDATA[$F{YR5}]]></variableExpression>
</variable>
<variable name="sumA" class="java.lang.Integer" calculation="Sum">
<variableExpression><![CDATA[$F{YR1}+$F{YR2}+$F{YR3}+$F{YR4}+$F{YR5}]]></variableExpression>
</variable>
<group name="Agency">
<groupExpression><![CDATA[$F{PARENT_NAME_SECTOR}]]></groupExpression>
<groupHeader>
<band height="192">
<textField>
<reportElement x="622" y="83" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{SECTOR_NAME}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="64" y="145" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{AGENCY_NAME}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="74" y="83" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{DYEAR1}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="18" y="83" width="56" height="20"/>
<textElement/>
<text><![CDATA[Year From :]]></text>
</staticText>
<staticText>
<reportElement x="18" y="104" width="56" height="20"/>
<textElement/>
<text><![CDATA[Year To :]]></text>
</staticText>
<staticText>
<reportElement x="574" y="83" width="48" height="20"/>
<textElement/>
<text><![CDATA[Sector :]]></text>
</staticText>
<staticText>
<reportElement x="18" y="145" width="46" height="20"/>
<textElement/>
<text><![CDATA[Agency :]]></text>
</staticText>
<textField>
<reportElement x="74" y="104" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{DYEAR5}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="0" y="21" width="802" height="26"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[5 YEAR STATISTICS ON APPLICATION RECEIVED (BY ALL AGENCIES)]]></text>
</staticText>
<staticText>
<reportElement x="18" y="165" width="33" height="27"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[No.]]></text>
</staticText>
<textField>
<reportElement x="425" y="178" width="85" height="14"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{DYEAR3}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="510" y="178" width="85" height="14"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{DYEAR4}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="595" y="178" width="85" height="14"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{DYEAR5}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="340" y="178" width="85" height="14"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{DYEAR2}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="255" y="178" width="85" height="14"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{DYEAR1}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="255" y="165" width="425" height="13"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<text><![CDATA[Year]]></text>
</staticText>
<staticText>
<reportElement x="51" y="165" width="204" height="27"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Agency Name]]></text>
</staticText>
<staticText>
<reportElement x="680" y="165" width="85" height="27"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<text><![CDATA[Total]]></text>
</staticText>
</band>
</groupHeader>
<groupFooter>
<band height="395">
<lineChart>
<chart>
<reportElement x="30" y="42" width="772" height="353"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<categoryDataset>
<dataset resetType="Group" resetGroup="Agency" incrementType="Report"/>
<categorySeries>
<seriesExpression><![CDATA[$F{PARENT_NAME_SECTOR}]]></seriesExpression>
<categoryExpression><![CDATA[$F{YEAR}]]></categoryExpression>
<valueExpression><![CDATA[$F{YR5}]]></valueExpression>
</categorySeries>
</categoryDataset>
<linePlot>
<plot/>
</linePlot>
</lineChart>
<textField>
<reportElement x="340" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$V{YR2_2}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="18" y="0" width="237" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<text><![CDATA[ Total]]></text>
</staticText>
<textField>
<reportElement x="255" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$V{YR1_2}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="425" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$V{YR3_2}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="510" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$V{YR4_2}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="595" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$V{YR5_2}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="680" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[new Integer($V{YR1_1}.intValue() + $V{YR2_1}.intValue()+
$V{YR3_1}.intValue()+ $V{YR4_1}.intValue())+ $V{YR5_1}.intValue()]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="20" splitType="Stretch">
<textField>
<reportElement x="510" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{YR4}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="51" y="0" width="204" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$F{PARENT_NAME_SECTOR}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="18" y="0" width="33" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$V{COLUMN_COUNT}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="255" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{YR1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="340" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{YR2}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="425" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{YR3}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="595" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{YR5}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="680" y="0" width="85" height="20"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[new Integer($F{YR1}.intValue() + $F{YR2}.intValue()+ $F{YR3}.intValue()+ $F{YR4}.intValue())+ $F{YR5}.intValue()]]></textFieldExpression>
</textField>
<break>
<reportElement x="0" y="19" width="802" height="1">
<printWhenExpression><![CDATA[($V{REPORT_COUNT} % 5 == 0)]]></printWhenExpression>
</reportElement>
</break>
</band>
</detail>
</jasperReport>
If I understand you correctly, you want to have 5 detail rows followed by the graph, and then a linebreak? The reason this is not happening is because you have the linegraph printing after every detail row. So it never actually hits the 5th row. You need to move the line graph to the
agnesi Group Footer 1section.UPDATE: If you only want the column header on the first page, then you need to add a printWhenExpression to it that has
$V{PAGE_NUMBER}==12nd UPDATE: You have a few things wrong with your report.
there. It makes does not make since to put a page break in the footer
at all.
to work the way you expect it to. The items in your Detail 2 section
more than likely be in the
Agency Group Footer 1with NO PageBreak.
Fields in there. Fields is the data in your datasource that are
iterated over in the group and detail section. As a best Guess this
should be moved into the
Agency Group Header 1instead of thecolumn header.
the
Detail 1section with the print when expression($V{REPORT_COUNT} % 5) == 0Something I find that helps me keep things clearer is to delete the sections altogether that I am not using. Once you do the things above I told you about, you could for example delete the title, page header, column header, page footer, and summary sections.