Jasperreport remove vertical space inside frames - jasper-reports

I have a jasperreport and I am trying to reduce the vertical size of its two frames. As you can see in this screenshot
The 3 frames (the surrounding frame and the two internal frames) are larger than the contents.
I have been struggling to reduce their size to the size of the contents but without success. Any ideas what I can do? The par1 = null, par2=2, par3=3, par4=4.
My jasperreport:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0 -->
<!-- 2015-12-23T17:08:07 -->
<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="report2" language="groovy" pageWidth="979" pageHeight="693" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="979" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="a6ccd207-3a74-42e6-8486-fc3b01795fb5">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<parameter name="par1" class="java.lang.String">
<defaultValueExpression><![CDATA[null]]></defaultValueExpression>
</parameter>
<parameter name="par2" class="java.lang.String">
<defaultValueExpression><![CDATA[null]]></defaultValueExpression>
</parameter>
<parameter name="par3" class="java.lang.String">
<defaultValueExpression><![CDATA[null]]></defaultValueExpression>
</parameter>
<parameter name="par4" class="java.lang.String">
<defaultValueExpression><![CDATA[null]]></defaultValueExpression>
</parameter>
<title>
<band height="80" splitType="Stretch">
<line>
<reportElement x="10" y="6" width="520" height="1" uuid="ebfc40ae-a2ee-40fc-b585-4236e9fa3c63"/>
</line>
<line>
<reportElement x="10" y="72" width="520" height="1" uuid="7657216f-1366-4455-adb0-db58e2333b5c"/>
</line>
<frame>
<reportElement x="329" y="10" width="172" height="59" isRemoveLineWhenBlank="true" uuid="0fbab6b3-f5ea-4716-b954-9371b4640781">
<property name="ShowOutOfBoundContent" value="false"/>
</reportElement>
<box>
<topPen lineWidth="0.4"/>
<leftPen lineWidth="0.4"/>
<bottomPen lineWidth="0.4"/>
<rightPen lineWidth="0.4"/>
</box>
<frame>
<reportElement positionType="Float" x="13" y="3" width="60" height="54" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true" uuid="8a663ee5-c983-40f9-b85e-11bc852f46cc">
<property name="ShowOutOfBoundContent" value="false"/>
</reportElement>
<box>
<topPen lineWidth="0.4"/>
<leftPen lineWidth="0.4"/>
<bottomPen lineWidth="0.4"/>
<rightPen lineWidth="0.4"/>
</box>
<textField isBlankWhenNull="true">
<reportElement x="1" y="20" width="52" height="20" isRemoveLineWhenBlank="true" uuid="84504631-a04d-4f75-bcb2-9e20741f29ad"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textFieldExpression><![CDATA[$P{par3} == null ? null : "P3: " + $P{par3}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="1" y="0" width="52" height="20" isRemoveLineWhenBlank="true" uuid="52c7e555-7e36-4992-8e59-b533fea31533"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textFieldExpression><![CDATA[$P{par1} == null ? null : "P1: " + $P{par1}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement positionType="Float" x="73" y="3" width="70" height="54" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true" uuid="3a53c02d-6559-4c64-8ca8-21254b50435e">
<property name="ShowOutOfBoundContent" value="false"/>
</reportElement>
<box>
<topPen lineWidth="0.4"/>
<leftPen lineWidth="0.4"/>
<bottomPen lineWidth="0.4"/>
<rightPen lineWidth="0.4"/>
</box>
<textField isBlankWhenNull="true">
<reportElement x="1" y="0" width="52" height="20" isRemoveLineWhenBlank="true" uuid="b0ca90f0-9364-4c4c-a8cf-1a54c60189a0"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textFieldExpression><![CDATA[$P{par2} == null ? null : "P2: " + $P{par2}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="1" y="20" width="52" height="20" isRemoveLineWhenBlank="true" uuid="f8b11d9c-fa8c-4e58-805a-4a8305b1bec1"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textFieldExpression><![CDATA[$P{par4} == null ? null : "P4: " + $P{par4}]]></textFieldExpression>
</textField>
</frame>
</frame>
</band>
</title>
</jasperReport>
Edit:
I tried to reduce the size of the frames and set their removeLineWhenBlank property to true, and now everything disappears if I set the values par1=par2=null, par3=3, par4=4. Why ? I only want to remove the lines that are blank, not all of them:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0 -->
<!-- 2015-12-23T18:22:07 -->
<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="report2" language="groovy" pageWidth="979" pageHeight="693" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="979" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="a6ccd207-3a74-42e6-8486-fc3b01795fb5">
<parameter name="par1" class="java.lang.String">
<defaultValueExpression><![CDATA[null]]></defaultValueExpression>
</parameter>
<parameter name="par2" class="java.lang.String">
<defaultValueExpression><![CDATA[null]]></defaultValueExpression>
</parameter>
<parameter name="par3" class="java.lang.String">
<defaultValueExpression><![CDATA[null]]></defaultValueExpression>
</parameter>
<parameter name="par4" class="java.lang.String">
<defaultValueExpression><![CDATA[null]]></defaultValueExpression>
</parameter>
<title>
<band height="141" splitType="Stretch">
<line>
<reportElement x="10" y="6" width="520" height="1" uuid="ebfc40ae-a2ee-40fc-b585-4236e9fa3c63"/>
</line>
<line>
<reportElement x="0" y="110" width="520" height="1" uuid="7657216f-1366-4455-adb0-db58e2333b5c"/>
</line>
<frame>
<reportElement x="329" y="10" width="172" height="43" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true" uuid="0fbab6b3-f5ea-4716-b954-9371b4640781">
<property name="ShowOutOfBoundContent" value="false"/>
</reportElement>
<box>
<topPen lineWidth="0.4"/>
<leftPen lineWidth="0.4"/>
<bottomPen lineWidth="0.4"/>
<rightPen lineWidth="0.4"/>
</box>
<frame>
<reportElement positionType="Float" x="13" y="3" width="60" height="40" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true" uuid="8a663ee5-c983-40f9-b85e-11bc852f46cc">
<property name="ShowOutOfBoundContent" value="false"/>
</reportElement>
<box>
<topPen lineWidth="0.4"/>
<leftPen lineWidth="0.4"/>
<bottomPen lineWidth="0.4"/>
<rightPen lineWidth="0.4"/>
</box>
<textField isBlankWhenNull="true">
<reportElement x="1" y="20" width="52" height="20" isRemoveLineWhenBlank="true" uuid="84504631-a04d-4f75-bcb2-9e20741f29ad"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textFieldExpression><![CDATA[$P{par3} == null ? null : "P3: " + $P{par3}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="1" y="0" width="52" height="20" isRemoveLineWhenBlank="true" uuid="52c7e555-7e36-4992-8e59-b533fea31533"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textFieldExpression><![CDATA[$P{par1} == null ? null : "P1: " + $P{par1}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement positionType="Float" x="73" y="3" width="70" height="40" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true" uuid="3a53c02d-6559-4c64-8ca8-21254b50435e">
<property name="ShowOutOfBoundContent" value="false"/>
</reportElement>
<box>
<topPen lineWidth="0.4"/>
<leftPen lineWidth="0.4"/>
<bottomPen lineWidth="0.4"/>
<rightPen lineWidth="0.4"/>
</box>
<textField isBlankWhenNull="true">
<reportElement x="1" y="0" width="52" height="20" isRemoveLineWhenBlank="true" uuid="b0ca90f0-9364-4c4c-a8cf-1a54c60189a0"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textFieldExpression><![CDATA[$P{par2} == null ? null : "P2: " + $P{par2}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="1" y="20" width="52" height="20" isRemoveLineWhenBlank="true" uuid="f8b11d9c-fa8c-4e58-805a-4a8305b1bec1"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textFieldExpression><![CDATA[$P{par4} == null ? null : "P4: " + $P{par4}]]></textFieldExpression>
</textField>
</frame>
</frame>
</band>
</title>
</jasperReport>

what is the format that you are generating your reports. Lets assume you are generating reports in HTML format and the following trick will do the job.
<property name ="net.sf.jasperreports.export.html.using.images.to.align" value="false"/>
Hope that helps .

Related

Duplicate data in jasper

I have very simple select query in my dataset and Query dialog. When I run this query I get 2 times more data fields as there are in the database! And my report book has more pages than the report itself, which I guess happens because of the redundant data. The same query delivers 3 data fields even without distinct and in Jaspersoft 6 data fields!
select distinct *
from KennzahlReferenz2015_QIBericht, Images
where LB_ID = 62
and KN_OffiziellGruppe =3
and IMG_ID = 1
And here is the source code of report:
<?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="direktRechrDV" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="d12b4217-cf22-4ec4-857b-9cb1b2b406a8">
<property name="net.sf.jasperreports.print.create.bookmarks" value="true"/>
<scriptlet name="moveTOC" class="testProjektIman.toc.MoveTOC">
<scriptletDescription><![CDATA[moves toc to first page]]> </scriptletDescription>
</scriptlet>
<parameter name="LB_ID" class="java.lang.Integer">
<parameterDescription><![CDATA[ID des Leistungsbereiches]]> </parameterDescription>
<defaultValueExpression><![CDATA[62]]></defaultValueExpression>
</parameter>
<parameter name="KN_OffeziellGruppe" class="java.lang.Integer">
<defaultValueExpression><![CDATA[3]]></defaultValueExpression>
</parameter>
<parameter name="toc" class="java.lang.StringBuilder" isForPrompting="false">
<defaultValueExpression><![CDATA[new StringBuilder()]]></defaultValueExpression>
</parameter>
<parameter name="idName" class="java.lang.String" isForPrompting="false"/>
<queryString>
<![CDATA[select distinct *
from KennzahlReferenz2015_QIBericht, Images
where
LB_ID = $P{LB_ID}
and
KN_OffiziellGruppe =$P{KN_OffeziellGruppe}
and IMG_ID = 1]]>
</queryString>
<field name="QI_Praefix" class="java.lang.String"/>
<!--
.
.other fields
. -->
<field name="Image" class="java.awt.Image"/>
<variable name="someVar" class="java.lang.String">
<variableExpression><![CDATA[$V{someVar}]]></variableExpression>
</variable>
<variable name="tocVar" class="java.lang.String">
<variableExpression><![CDATA[$V{tocVar}]]></variableExpression>
</variable>
<group name="id" isStartNewPage="true" isReprintHeaderOnEachPage="true" keepTogether="true">
<groupExpression><![CDATA[$F{KN_Id}]]></groupExpression>
<groupFooter>
<band splitType="Immediate">
</band>
</groupFooter>
</group>
<group name="LBgroup" isReprintHeaderOnEachPage="true" keepTogether="true">
<groupExpression><![CDATA[$F{LB_ID}]]></groupExpression>
<groupFooter>
<band splitType="Immediate"/>
</groupFooter>
</group>
<pageHeader>
<band height="62" splitType="Stretch">
<staticText>
<reportElement x="8" y="2" width="409" height="26" uuid="37a242c0-b352-42e1-b287-42350a5e2090"/>
<textElement markup="html"/>
<text><![CDATA[Statistische Basisprüfung - Auffälligkeitskriterien: Verstetigung und Vollzähligkeit 2015<br>]]></text>
</staticText>
<textField isStretchWithOverflow="true">
<reportElement x="7" y="16" width="322" height="19" uuid="f28c3fc0-6d00-4437-a185-febccf94e91f"/>
<textElement markup="none"/>
<textFieldExpression><![CDATA[$F{idLb} +" - "+ $F{LB_LangBezeichnung}]]></textFieldExpression>
</textField>
<textField bookmarkLevel="1">
<reportElement x="8" y="32" width="321" height="20" uuid="705007c1-4bfa-483a-a113-887cf7fd6488"/>
<textFieldExpression><![CDATA[$F{KN_Id}+": "+$F{KN_BezeichnungAlleinstehendKurz}]]></textFieldExpression>
<anchorNameExpression><![CDATA[$F{KN_Id}+":"+$F{nameAlleinstehend}]]></anchorNameExpression>
</textField>
<image hAlign="Center">
<reportElement x="480" y="6" width="50" height="50" uuid="3f5fe998-e94e-4280-af71-7f7163878156">
<printWhenExpression><![CDATA[$F{IMG_ID} == 1]]></printWhenExpression>
</reportElement>
<imageExpression><![CDATA[$F{Image}]]></imageExpression>
</image>
</band>
</pageHeader>
<columnHeader>
<band splitType="Stretch"/>
</columnHeader>
<detail>
<band height="345">
<printWhenExpression><![CDATA[new Boolean($V{id_COUNT}.intValue()==1)]]></printWhenExpression>
<frame>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="8" y="40" width="292" height="220" uuid="55ca2869-dd02-48a5-a9bf-90b538ea22a6"/>
<frame>
<reportElement positionType="Float" x="0" y="0" width="280" height="21" printWhenGroupChanges="id" uuid="255952d3-ed97-4615-926f-e7e89560d64a"/>
<textField isStretchWithOverflow="true">
<reportElement key="" positionType="Float" x="99" y="0" width="181" height="21" printWhenGroupChanges="id" uuid="83851dcf-a0b2-44df-9117-0c5487b16260">
<property name="net.sf.jasperreports.export.json.path" value="AK.id"/>
<property name="net.sf.jasperreports.export.json.repeat.value" value="true"/>
</reportElement>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement>
<paragraph leftIndent="1"/>
</textElement>
<textFieldExpression><![CDATA[$F{KN_Id}]]></textFieldExpression>
</textField>
<staticText>
<reportElement positionType="Float" stretchType="RelativeToBandHeight" mode="Opaque" x="0" y="0" width="99" height="21" printWhenGroupChanges="id" forecolor="#FFFFFF" backcolor="#005051" uuid="168d731e-09c0-4b1e-ac6f-c86168fe1286">
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
</reportElement>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<text><![CDATA[AK_ID]]></text>
</staticText>
</frame>
<frame>
<reportElement positionType="Float" x="0" y="21" width="280" height="21" printWhenGroupChanges="id" uuid="0879346c-a263-431d-8e2d-8d2a1cd0e67c"/>
<staticText>
<reportElement positionType="Float" stretchType="RelativeToBandHeight" mode="Opaque" x="0" y="0" width="99" height="21" printWhenGroupChanges="id" forecolor="#FFFFFF" backcolor="#005051" uuid="75c8f9aa-47d6-4869-b8b2-a16ca58e11db"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<text><![CDATA[Präfix]]></text>
</staticText>
<textField isStretchWithOverflow="true">
<reportElement key="" positionType="Float" x="99" y="0" width="181" height="21" printWhenGroupChanges="id" uuid="f38998f8-8dc7-4ccc-8066-0cfe5e7ab876">
<property name="net.sf.jasperreports.export.json.path" value="qi.praefix"/>
<property name="net.sf.jasperreports.export.json.repeat.value" value="true"/>
</reportElement>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement>
<paragraph leftIndent="1"/>
</textElement>
<textFieldExpression><![CDATA[$F{QI_Praefix}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement positionType="Float" x="0" y="42" width="280" height="30" printWhenGroupChanges="id" uuid="92186cbd-4a98-4c6e-9b51-0dfe52d5ff21"/>
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" x="99" y="0" width="181" height="30" printWhenGroupChanges="id" uuid="4818fc44-cde3-40ed-8d77-a6dd71b89f79">
<property name="net.sf.jasperreports.export.json.path" value="begruendung.relevanz"/>
<property name="net.sf.jasperreports.export.json.repeat.value" value="true"/>
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement markup="html">
<paragraph leftIndent="1"/>
</textElement>
<textFieldExpression><![CDATA["<b>Relevanz</b><br>" +($F{KN_Zusatzinfo_DV_Relevanz} !=null ? $F{KN_Zusatzinfo_DV_Relevanz} : "-")+"<br><b>Hypothese</b><br>" + ($F{KN_Zusatzinfo_DV_Hypothese} !=null ? $F{KN_Zusatzinfo_DV_Hypothese}: "-")]]></textFieldExpression>
</textField>
<staticText>
<reportElement positionType="Float" stretchType="RelativeToBandHeight" mode="Opaque" x="0" y="0" width="99" height="30" printWhenGroupChanges="id" forecolor="#FFFFFF" backcolor="#005051" uuid="a93eb1cf-015c-442a-afac-68c7f9a30cb5">
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
</reportElement>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement>
<paragraph lineSpacing="Single"/>
</textElement>
<text><![CDATA[Begründung für die Auswahl]]></text>
</staticText>
</frame>
<frame>
<reportElement positionType="Float" x="0" y="72" width="280" height="27" printWhenGroupChanges="id" uuid="91d6b54a-bcd4-4737-8208-7dcd9e388ea4">
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
</reportElement>
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" x="99" y="0" width="181" height="27" printWhenGroupChanges="id" uuid="883db6cf-5cc6-4e32-a4cd-54bdf86b97df">
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement rotation="None">
<paragraph leftIndent="1"/>
</textElement>
<textFieldExpression><![CDATA[($F{KN_Zusatzinfo_DV_Indikatorbezug} !=null ? $F{KN_Zusatzinfo_DV_Indikatorbezug} : "-")]]></textFieldExpression>
</textField>
<staticText>
<reportElement positionType="Float" stretchType="RelativeToBandHeight" mode="Opaque" x="0" y="-1" width="99" height="27" printWhenGroupChanges="id" forecolor="#FFFFFF" backcolor="#005051" uuid="61373b56-22c7-4097-8da1-ebcd702bc410">
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
</reportElement>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<text><![CDATA[Bezug zu anderen Indikatoren]]></text>
</staticText>
</frame>
<frame>
<reportElement positionType="Float" x="0" y="99" width="280" height="27" printWhenGroupChanges="id" uuid="be213a60-4cd9-4f4a-972b-edfbf7b408c9"/>
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" x="99" y="0" width="181" height="27" printWhenGroupChanges="id" uuid="261644b6-bbdb-4528-9f25-7fb23e98bf99">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement>
<paragraph leftIndent="1"/>
</textElement>
<textFieldExpression><![CDATA[$F{bewertungsArtTypNameKurz}]]></textFieldExpression>
</textField>
<staticText>
<reportElement positionType="Float" stretchType="RelativeToBandHeight" mode="Opaque" x="0" y="0" width="99" height="27" printWhenGroupChanges="id" forecolor="#FFFFFF" backcolor="#005051" uuid="d338843f-2f88-4d1b-b355-e7757acacf8e">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
</reportElement>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<text><![CDATA[Bewertungsart]]></text>
</staticText>
</frame>
<frame>
<reportElement positionType="Float" x="0" y="127" width="280" height="27" printWhenGroupChanges="id" uuid="626fe004-8942-4655-8c64-4022728e65e9"/>
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" x="99" y="0" width="181" height="27" printWhenGroupChanges="id" uuid="3ea786ed-6ce2-4ce7-84af-b4b7d29cc3b7">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement>
<paragraph leftIndent="1"/>
</textElement>
<textFieldExpression><![CDATA[$F{mindesanzahlZaeler}]]></textFieldExpression>
</textField>
<staticText>
<reportElement positionType="Float" stretchType="RelativeToBandHeight" mode="Opaque" x="0" y="-1" width="99" height="27" printWhenGroupChanges="id" forecolor="#FFFFFF" backcolor="#005051" uuid="284779f8-692b-45b1-a535-62f1a4ce124b">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
</reportElement>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<text><![CDATA[Mindestanzahl Zähler]]></text>
</staticText>
</frame>
<frame>
<reportElement positionType="Float" x="0" y="154" width="280" height="27" uuid="f2f30758-914b-4990-b508-644cabb06f3f"/>
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" x="99" y="0" width="181" height="27" printWhenGroupChanges="id" uuid="77c50b2a-a9ec-4225-8361-4daa6dc9d97e">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement>
<paragraph leftIndent="1"/>
</textElement>
<textFieldExpression><![CDATA[$F{KN_Vergleichbarkeit_Vorjahr}]]></textFieldExpression>
</textField>
<staticText>
<reportElement positionType="Float" stretchType="RelativeToBandHeight" mode="Opaque" x="0" y="0" width="99" height="27" printWhenGroupChanges="id" forecolor="#FFFFFF" backcolor="#005051" uuid="4f5650a6-9330-444b-bfec-0c1cd03d254f">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
</reportElement>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<text><![CDATA[Vergleichbarkeit mit Vorjahr]]></text>
</staticText>
</frame>
<frame>
<reportElement positionType="Float" x="0" y="182" width="280" height="27" uuid="3a70786a-ab1b-4193-8087-bcf9f363116a"/>
<textField isStretchWithOverflow="true" isBlankWhenNull="false">
<reportElement positionType="Float" x="99" y="-1" width="181" height="27" printWhenGroupChanges="id" uuid="0d48b38a-07e8-42e7-89e8-e0580651028e">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement>
<paragraph leftIndent="1"/>
</textElement>
<textFieldExpression><![CDATA[$F{mindesanzahlNenner}]]></textFieldExpression>
</textField>
<staticText>
<reportElement positionType="Float" stretchType="RelativeToBandHeight" mode="Opaque" x="0" y="-1" width="99" height="27" printWhenGroupChanges="id" forecolor="#FFFFFF" backcolor="#005051" uuid="fc8232c6-dfb5-482a-9fef-a9ac1f75861a">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
</reportElement>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<text><![CDATA[Mindestanzahl Nenner]]></text>
</staticText>
</frame>
</frame>
<textField isStretchWithOverflow="true" hyperlinkType="" hyperlinkTarget="">
<reportElement mode="Transparent" x="0" y="4" width="340" height="6" printWhenGroupChanges="id" uuid="56a6e5f3-fd57-436e-8acb-8dbc1acbb220">
<printWhenExpression><![CDATA[1==0]]></printWhenExpression>
</reportElement>
<textElement markup="html"/>
<textFieldExpression><![CDATA[$F{KN_Id}+":"+$F{nameAlleinstehend}]]></textFieldExpression>
<hyperlinkReferenceExpression><![CDATA[]]></hyperlinkReferenceExpression>
</textField>
<staticText>
<reportElement x="11" y="14" width="78" height="16" uuid="17d269d4-d7fa-44ef-8b00-d1abe0ecb92c"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Berechnung]]></text>
</staticText>
</band>
</detail>
<columnFooter>
<band splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</band>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch">
<staticText>
<reportElement x="0" y="20" width="410" height="20" uuid="0744ba3c-69d3-4220-b201-72dabdeb5038"/>
<textElement>
<font size="8"/>
</textElement>
<text><![CDATA[ins]]></text>
</staticText>
<textField evaluationTime="Master">
<reportElement x="481" y="18" width="69" height="24" uuid="5789c6a7-2ca2-4ba9-bd13-1b56ddcb7091"/>
<textFieldExpression><![CDATA["Seite "+$V{MASTER_CURRENT_PAGE}+" von"+$V{MASTER_TOTAL_PAGES}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
</jasperReport>
And here is the report book:
<?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="qidbReport" pageWidth="595" pageHeight="842" sectionType="Part" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="30" bottomMargin="30" uuid="d2716064-8ae4-40cf-a575-33afba400e3a">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="KennzahlReferenz2015_QIBericht"/>
<property name="net.sf.jasperreports.print.create.bookmarks" value="true"/>
<property name="com.jaspersoft.studio.book.group.cover.header" value="Cover and Table of Contents"/>
<property name="com.jaspersoft.studio.book.group.cover.footer" value="Backcover"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<queryString>
<![CDATA[select distinct KN_Id , "KennzahlReferenz2015_QIBericht"."nameAlleinstehend" , Image from "KennzahlReferenz2015_QIBericht", Images where LB_ID = 62
and "KN_OffiziellGruppe" =3 and IMG_ID = 1]]>
</queryString>
<field name="KN_Id" class="java.lang.Integer"/>
<field name="nameAlleinstehend" class="java.lang.String"/>
<field name="Image" class="java.awt.Image"/>
<group name="cover">
<groupHeader>
<part uuid="7aed05b9-1301-4a53-b47e-34289560bc0c">
<p:subreportPart xmlns:p="http://jasperreports.sourceforge.net/jasperreports/parts" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/parts http://jasperreports.sourceforge.net/xsd/parts.xsd">
<subreportExpression><![CDATA["qidbReport_cover.jasper"]]></subreportExpression>
</p:subreportPart>
</part>
<part evaluationTime="Report" uuid="56ab525c-754f-4f48-a52c-7cc23934be3d">
<property name="net.sf.jasperreports.bookmarks.data.source.parameter" value="REPORT_DATA_SOURCE"/>
<p:subreportPart xmlns:p="http://jasperreports.sourceforge.net/jasperreports/parts" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/parts http://jasperreports.sourceforge.net/xsd/parts.xsd">
<subreportExpression><![CDATA["qidbReport_toc.jasper"]]></subreportExpression>
</p:subreportPart>
</part>
</groupHeader>
<groupFooter>
<part uuid="88decbbe-63ad-45cc-9e03-5dadc50004d5">
<p:subreportPart xmlns:p="http://jasperreports.sourceforge.net/jasperreports/parts" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/parts http://jasperreports.sourceforge.net/xsd/parts.xsd">
<subreportExpression><![CDATA["qidbReport_backcover.jasper"]]></subreportExpression>
</p:subreportPart>
</part>
</groupFooter>
</group>
<detail>
<part uuid="fbf811eb-2c43-48b9-a88b-ae94453264df">
<p:subreportPart xmlns:p="http://jasperreports.sourceforge.net/jasperreports/parts" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/parts http://jasperreports.sourceforge.net/xsd/parts.xsd">
<subreportParameter name="REPORT_CONNECTION">
<subreportParameterExpression><![CDATA[$P{REPORT_CONNECTION}]]></subreportParameterExpression>
</subreportParameter>
<subreportExpression><![CDATA["direktRechrDV.jasper"]]></subreportExpression>
</p:subreportPart>
</part>
</detail>
</jasperReport>
These are the outputs from JR and DB:
Jasper:
DB:
The problem is not because of the driver or source code. It happens when I add a report books. Then the wave book asks for a data source and query. When I write a query there, jasper adds those results to the ones from main report.

How to display one group per page using Jasper Reports?

I'm using iReport to create a Jasper Report template, and I need to display one group per page:
Group 1: (Page One)
-Field1 Field2 Field3
Group 2: (Page Two)
-Field1 Field2 Field3
And so on.
I tried setting the Maximize Band Height property to true in the "Group Footer" band using iReport, but some empty pages are added when I try to review.
You can use isStartNewPage attribute of group.
You can add Group Header band and
1) set "Start on a new page" attribute as true
2) set band height as 0 (if you don't need it).
The working sample
The jrxml file:
<?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="group_break" language="groovy" pageWidth="400" pageHeight="400" columnWidth="360" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="2bcb6f3d-2169-44f6-9e8a-db54ea21b5e0">
<queryString>
<![CDATA[SELECT DOCUMENTID, PRODUCTID, PRICE FROM POSITIONS ORDER BY DOCUMENTID]]>
</queryString>
<field name="DOCUMENTID" class="java.lang.Integer"/>
<field name="PRODUCTID" class="java.lang.Integer"/>
<field name="PRICE" class="java.math.BigDecimal"/>
<group name="docId" isStartNewPage="true">
<groupExpression><![CDATA[$F{DOCUMENTID}]]></groupExpression>
<groupHeader>
<band/>
</groupHeader>
</group>
<columnHeader>
<band height="20" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="111" height="20" uuid="596f5fb4-7e6d-4e7e-88bf-b9c37d0fb1a1"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center"/>
<text><![CDATA[Position]]></text>
</staticText>
<staticText>
<reportElement x="111" y="0" width="111" height="20" uuid="4884f663-00cf-4b5f-9cc1-05d698b8154a"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center"/>
<text><![CDATA[Id]]></text>
</staticText>
<staticText>
<reportElement x="222" y="0" width="111" height="20" uuid="26c8d18f-2281-405c-a41b-bddcbcdebdbb"/>
<box>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center"/>
<text><![CDATA[Price]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="20" splitType="Stretch">
<textField>
<reportElement x="0" y="0" width="111" height="20" uuid="fb6369eb-4b92-41dd-b5b8-94a9210bf315"/>
<box leftPadding="10">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textFieldExpression><![CDATA[$F{DOCUMENTID}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="111" y="0" width="111" height="20" uuid="9fcbb785-06fa-4f7a-bc6d-301cc8db4388"/>
<box leftPadding="10">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textFieldExpression><![CDATA[$F{PRODUCTID}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="222" y="0" width="111" height="20" uuid="0d18c9fe-5a70-4890-b94d-f26d88bc97da"/>
<box leftPadding="10">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textFieldExpression><![CDATA[$F{PRICE}]]></textFieldExpression>
</textField>
</band>
</detail>
<pageFooter>
<band height="50">
<textField>
<reportElement x="0" y="20" width="80" height="20" uuid="47486fe9-e21f-4913-a9c4-cef0d3e2df39"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="80" y="20" width="40" height="20" uuid="0f7df66b-bbe6-4373-962e-519584c44541"/>
<textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
</jasperReport>
The result
The output result generated in iReport via preview mode

Remove line when blank when beside an image

So I figured out how to have a textbox be removed and it's space collapse when it is null/blank.
But now I have an image on the other side of the page that is stopping this functionality.
I'm guessing since it is on the same line it won't collapse the space.
This is what it looks like:
... -------------------
Address 1 | |
Address 2 (if blank remove) | PICTURE |
Address 3 (if blank remove) | |
... -------------------
Is there a way to have the image not affect this? Can I put it in a frame or something? Or is there a property I am unaware of?
Hopefully someone has come across this before.
Since you have figured out "how to have a textbox be removed and it's space collapse when it is null/blank", I assume that you are aware of attributes like isBlankWhenNull="true" and isRemoveLineWhenBlank="true".
But now you have a picture in the same vertical space along with address fields. So you have to put them into two different vertical frames. Enclose the fields Address1, Address2, Address3 etc. into one frame and picture into other frame. Here is the sample JRXML code to test it. Save this code as report2.jrxml and run it. Play around the values of parm1...parm5 to get desired output.
<?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="report2" language="groovy" pageWidth="979" pageHeight="693" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="979" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="a6ccd207-3a74-42e6-8486-fc3b01795fb5">
<parameter name="par1" class="java.lang.String">
<defaultValueExpression><![CDATA[null]]></defaultValueExpression>
</parameter>
<parameter name="par2" class="java.lang.String">
<defaultValueExpression><![CDATA[null]]></defaultValueExpression>
</parameter>
<parameter name="par3" class="java.lang.String">
<defaultValueExpression><![CDATA[null]]></defaultValueExpression>
</parameter>
<parameter name="par4" class="java.lang.String">
<defaultValueExpression><![CDATA[null]]></defaultValueExpression>
</parameter>
<parameter name="par5" class="java.lang.String">
<defaultValueExpression><![CDATA[null]]></defaultValueExpression>
</parameter>
<pageHeader>
<band height="174" splitType="Stretch">
<line>
<reportElement x="10" y="61" width="520" height="1" uuid="9e329029-596a-4741-80b2-4dd31e7f0a2a"/>
</line>
<line>
<reportElement x="10" y="157" width="520" height="1" uuid="eee16285-f6e5-4275-9911-b8ba0b330c08"/>
</line>
<frame>
<reportElement x="46" y="65" width="154" height="76" uuid="fac4c0b1-a3b2-431a-b766-1954512e5b12"/>
<textField isBlankWhenNull="true">
<reportElement x="42" y="20" width="52" height="20" isRemoveLineWhenBlank="true" uuid="949799db-d6be-404d-98c5-e6a69c0d917f"/>
<box leftPadding="10">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textFieldExpression><![CDATA[$P{par3} == null ? null : "P3: " + $P{par3}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="42" y="0" width="52" height="20" isRemoveLineWhenBlank="true" uuid="a1b3fa51-8c0e-496d-8759-2a51eb58bc33"/>
<box leftPadding="10">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textFieldExpression><![CDATA[$P{par1} == null ? null : "P1: " + $P{par1}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="42" y="40" width="52" height="20" isRemoveLineWhenBlank="true" uuid="3944fa92-8b0c-4965-81c2-036696bb1295"/>
<box leftPadding="10">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textFieldExpression><![CDATA[$P{par5} == null ? null : "P5: " + $P{par5}]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement x="341" y="65" width="189" height="76" uuid="b074b915-2d61-4df8-95b1-12e3901b0604"/>
<textField isBlankWhenNull="true">
<reportElement x="62" y="0" width="52" height="20" isRemoveLineWhenBlank="true" uuid="8c371d13-9eb4-4cf6-b9b8-38052e0dc933"/>
<box leftPadding="10">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textFieldExpression><![CDATA[$P{par2} == null ? null : "P2: " + $P{par2}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="62" y="20" width="52" height="20" isRemoveLineWhenBlank="true" uuid="eee7c8ca-a46c-40f1-9701-36a388357108"/>
<box leftPadding="10">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textFieldExpression><![CDATA[$P{par4} == null ? null : "P4: " + $P{par4}]]></textFieldExpression>
</textField>
</frame>
</band>
</pageHeader>
</jasperReport>
OUTPUT:
When all params are non null
OUTPUT: When P3 is null

Conditional Horizontal line in jasperreport between results

I'm using jasperreport 4.7.0
I have a query where I order by name then date .
Now the clients wants that when the name changes that we add an horizontal line (see attached img - red line)
Is there a way to accomplish this without duplicating the query and the fields ?
Result :
For solving your task you can use Data Grouping.
The possible steps (there are a lot of way to reach your target) for adding line are:
Create the report Group (via context menu Add Report Group in iReport) on field
Add Group Footer Band
Add Rectangle element to the Group Footer Band
Set Height, Forecolor and Backcolor for this Rectangle - drawing "red pencil line"
The sample:
<?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="line_in_group" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="f1394ead-7ad6-4371-979d-5a13d1bdde4d">
<queryString>
<![CDATA[SELECT id, city, street FROM address ORDER BY city]]>
</queryString>
<field name="ID" class="java.lang.Integer"/>
<field name="CITY" class="java.lang.String"/>
<field name="STREET" class="java.lang.String"/>
<group name="cityGroup">
<groupExpression><![CDATA[$F{CITY}]]></groupExpression>
<groupFooter>
<band height="2">
<rectangle>
<reportElement uuid="6564e743-2a45-4b51-89a5-e3ec6aee291f" x="0" y="0" width="300" height="2" forecolor="#FF0000" backcolor="#FF0000"/>
</rectangle>
</band>
</groupFooter>
</group>
<columnHeader>
<band height="20" splitType="Stretch">
<staticText>
<reportElement uuid="77860b22-95f6-41b6-955a-f8991843e221" x="0" y="0" width="100" height="20"/>
<box leftPadding="10">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center">
<font isBold="true" isItalic="true"/>
</textElement>
<text><![CDATA[ID]]></text>
</staticText>
<staticText>
<reportElement uuid="77860b22-95f6-41b6-955a-f8991843e221" x="100" y="0" width="100" height="20"/>
<box leftPadding="10">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center">
<font isBold="true" isItalic="true"/>
</textElement>
<text><![CDATA[City]]></text>
</staticText>
<staticText>
<reportElement uuid="77860b22-95f6-41b6-955a-f8991843e221" x="200" y="0" width="100" height="20"/>
<box leftPadding="10">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center">
<font isBold="true" isItalic="true"/>
</textElement>
<text><![CDATA[Street]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="20" splitType="Stretch">
<textField>
<reportElement uuid="7e375aa3-fab5-4761-bab9-a0570a5442b1" x="0" y="0" width="100" height="20"/>
<box leftPadding="10">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement/>
<textFieldExpression><![CDATA[$F{ID}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="7e375aa3-fab5-4761-bab9-a0570a5442b1" x="100" y="0" width="100" height="20"/>
<box leftPadding="10">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement/>
<textFieldExpression><![CDATA[$F{CITY}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="7e375aa3-fab5-4761-bab9-a0570a5442b1" x="200" y="0" width="100" height="20"/>
<box leftPadding="10">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement/>
<textFieldExpression><![CDATA[$F{STREET}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
The result will be (via preview in iReport):
In this sample I've create a group for the field CITY.

How to generate separate pages for each group? [duplicate]

This question already has an answer here:
New page for every group in iReport
(1 answer)
Closed 2 years ago.
Story:
Two Domain Objects:
class JasperProject {
private String ...
}
class JasperProjectGroup {
private String ...
private List<JasperProject> ...
}
Code for Jasper:
Map<String, Object> parameters = new HashMap<String, Object>();
List<JasperProjectGroup> groups = buildGroups();
parameters.put("groups", groups);
InputStream jasperReportInputStream = ProjectStatusReportGenerator.class.getClassLoader().getResourceAsStream(
PROJECT_STATUS_JASPER_REPORT_FILENAME);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReportInputStream, parameters,
new JREmptyDataSource());
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
return outputStream.toByteArray();
I want to create a pdf report with tables which each group table on each separate page (e.g. table for group 1 on page1, table for group 2 on page2).
However, when I pass the groups as parameter to Jasper template, it display just one table contains all the groups on the pdf report.
XML code for jrxml
First xml:
<?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="timesheets" pageWidth="595" pageHeight="842" columnWidth="555" 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="0"/>
<parameter name="groups" class="java.util.Collection"/>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="800" splitType="Stretch">
<subreport runToBottom="true">
<reportElement x="0" y="0" width="515" height="800"/>
<dataSourceExpression><![CDATA[(new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{groups}))]]></dataSourceExpression>
<subreportExpression><![CDATA[net.sf.jasperreports.engine.data.JRBeanCollectionDataSource.class.getClassLoader().getResourceAsStream("projectgroup.jasper")]]></subreportExpression>
</subreport>
</band>
</detail>
</jasperReport>
Second template (projectgroup.jrxml):
<?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="projectgroup" pageWidth="595" pageHeight="842" columnWidth="555" 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="0"/>
<subDataset name="TableDataset1">
<field name="projectName" class="java.lang.String"/>
<field name="bookedHours" class="java.lang.String"/>
<field name="predictedHours" class="java.lang.String"/>
<field name="burnedHours" class="java.lang.String"/>
<field name="percentageComplete" class="java.lang.String"/>
<field name="bookedHoursBurned" class="java.lang.String"/>
</subDataset>
<field name="jasperProjectStatusReports" class="java.util.List"/>
<detail>
<band height="50" splitType="Stretch">
<subreport>
<reportElement x="0" y="0" width="515" height="50"/>
<dataSourceExpression><![CDATA[(new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{jasperProjectStatusReports}))]]></dataSourceExpression>
<subreportExpression><![CDATA[net.sf.jasperreports.engine.data.JRBeanCollectionDataSource.class.getClassLoader().getResourceAsStream("projectgroup_table.jasper")]]></subreportExpression>
</subreport>
</band>
</detail>
</jasperReport>
Third template xml (projectgroup_table.jasper):
<?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="projectgroup_table" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<field name="groupName" class="java.lang.String"/>
<field name="projectName" class="java.lang.String"/>
<field name="bookedHours" class="java.lang.String"/>
<field name="predictedHours" class="java.lang.String"/>
<field name="burnedHours" class="java.lang.String"/>
<field name="percentageComplete" class="java.lang.String"/>
<field name="bookedHoursBurned" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<columnHeader>
<band height="20" splitType="Stretch">
<textField>
<reportElement mode="Opaque" x="0" y="0" width="100" height="20" forecolor="#FFFFFF" backcolor="#006700"/>
<box leftPadding="5" rightPadding="5">
<pen lineWidth="1.0" lineColor="#000000"/>
<topPen lineWidth="1.0" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineColor="#000000"/>
</box>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{groupName}]]></textFieldExpression>
</textField>
<staticText>
<reportElement mode="Opaque" x="100" y="0" width="100" height="20" forecolor="#FFFFFF" backcolor="#006700"/>
<box leftPadding="5" rightPadding="5">
<pen lineWidth="1.0" lineColor="#000000"/>
<topPen lineWidth="1.0" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Booked]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="200" y="0" width="100" height="20" forecolor="#FFFFFF" backcolor="#006700"/>
<box leftPadding="5" rightPadding="5">
<pen lineWidth="1.0" lineColor="#000000"/>
<topPen lineWidth="1.0" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Predicted]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="300" y="0" width="100" height="20" forecolor="#FFFFFF" backcolor="#006700"/>
<box leftPadding="5" rightPadding="5">
<pen lineWidth="1.0" lineColor="#000000"/>
<topPen lineWidth="1.0" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Burned]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="400" y="0" width="100" height="20" forecolor="#FFFFFF" backcolor="#006700"/>
<box leftPadding="5" rightPadding="5">
<pen lineWidth="1.0" lineColor="#000000"/>
<topPen lineWidth="1.0" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Complete]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="500" y="0" width="95" height="20" forecolor="#FFFFFF" backcolor="#006700"/>
<box leftPadding="5" rightPadding="5">
<pen lineWidth="1.0" lineColor="#000000"/>
<topPen lineWidth="1.0" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Booked Burned]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="21" splitType="Stretch">
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="100" height="20"/>
<box leftPadding="5">
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{projectName}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="100" y="0" width="100" height="20"/>
<box leftPadding="0" rightPadding="5">
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{bookedHours}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="200" y="0" width="100" height="20"/>
<box leftPadding="5">
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{predictedHours}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="300" y="0" width="100" height="20"/>
<box leftPadding="5">
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{burnedHours}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="400" y="0" width="100" height="20"/>
<box leftPadding="5">
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{percentageComplete}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="500" y="1" width="95" height="20"/>
<box leftPadding="5">
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{bookedHoursBurned}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
Are there any ideas about that? thanks.
Yes this can be done. If you expand the detail field by using ireprt... by this when once your one group got printed there will be no space for other group, so that next group will be on next page.
Its jasper report's built-in functionality.