title: Duplicate data in jasper
body: <p>I have very simple select query in my dataset and Query dialog. When I run this query I get <em>2 times more data fields</em> 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 <code>distinct</code> and in Jaspersoft 6 data fields! </p>
  
  <pre><code>select distinct * 
  from KennzahlReferenz2015_QIBericht, Images
  where LB_ID = 62
  and KN_OffiziellGruppe =3
  and IMG_ID = 1
  </code></pre>
  
  <p>And here is the source code of report:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;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"&gt;
  &lt;property name="net.sf.jasperreports.print.create.bookmarks" value="true"/&gt;
  
  &lt;scriptlet name="moveTOC" class="testProjektIman.toc.MoveTOC"&gt;
      &lt;scriptletDescription&gt;&lt;![CDATA[moves toc to first page]]&gt;  &lt;/scriptletDescription&gt;
  &lt;/scriptlet&gt;
  &lt;parameter name="LB_ID" class="java.lang.Integer"&gt;
      &lt;parameterDescription&gt;&lt;![CDATA[ID des Leistungsbereiches]]&gt;  &lt;/parameterDescription&gt;
      &lt;defaultValueExpression&gt;&lt;![CDATA[62]]&gt;&lt;/defaultValueExpression&gt;
  &lt;/parameter&gt;
  &lt;parameter name="KN_OffeziellGruppe" class="java.lang.Integer"&gt;
      &lt;defaultValueExpression&gt;&lt;![CDATA[3]]&gt;&lt;/defaultValueExpression&gt;
  &lt;/parameter&gt;
  &lt;parameter name="toc" class="java.lang.StringBuilder"  isForPrompting="false"&gt;
      &lt;defaultValueExpression&gt;&lt;![CDATA[new StringBuilder()]]&gt;&lt;/defaultValueExpression&gt;
  &lt;/parameter&gt;
      &lt;parameter name="idName" class="java.lang.String" isForPrompting="false"/&gt;
      &lt;queryString&gt;
      &lt;![CDATA[select distinct * 
  from KennzahlReferenz2015_QIBericht, Images
  where
  LB_ID = $P{LB_ID}  
  and 
  KN_OffiziellGruppe =$P{KN_OffeziellGruppe}
  and IMG_ID = 1]]&gt;
  &lt;/queryString&gt;
  &lt;field name="QI_Praefix" class="java.lang.String"/&gt;
  &lt;!--
  .
  .other fields
  . --&gt;
  &lt;field name="Image" class="java.awt.Image"/&gt;
  &lt;variable name="someVar" class="java.lang.String"&gt;
      &lt;variableExpression&gt;&lt;![CDATA[$V{someVar}]]&gt;&lt;/variableExpression&gt;
  &lt;/variable&gt;
  &lt;variable name="tocVar" class="java.lang.String"&gt;
      &lt;variableExpression&gt;&lt;![CDATA[$V{tocVar}]]&gt;&lt;/variableExpression&gt;
  &lt;/variable&gt;
  &lt;group name="id" isStartNewPage="true" isReprintHeaderOnEachPage="true" keepTogether="true"&gt;
      &lt;groupExpression&gt;&lt;![CDATA[$F{KN_Id}]]&gt;&lt;/groupExpression&gt;
      &lt;groupFooter&gt;
          &lt;band splitType="Immediate"&gt;
          &lt;/band&gt;
      &lt;/groupFooter&gt;
  &lt;/group&gt;
  &lt;group name="LBgroup" isReprintHeaderOnEachPage="true" keepTogether="true"&gt;
      &lt;groupExpression&gt;&lt;![CDATA[$F{LB_ID}]]&gt;&lt;/groupExpression&gt;
      &lt;groupFooter&gt;
          &lt;band splitType="Immediate"/&gt;
      &lt;/groupFooter&gt;
  &lt;/group&gt;
  &lt;pageHeader&gt;
      &lt;band height="62" splitType="Stretch"&gt;
          &lt;staticText&gt;
              &lt;reportElement x="8" y="2" width="409" height="26" uuid="37a242c0-b352-42e1-b287-42350a5e2090"/&gt;
              &lt;textElement markup="html"/&gt;
              &lt;text&gt;&lt;![CDATA[Statistische Basisprüfung - Auffälligkeitskriterien: Verstetigung und Vollzähligkeit 2015&lt;br&gt;]]&gt;&lt;/text&gt;
          &lt;/staticText&gt;
          &lt;textField isStretchWithOverflow="true"&gt;
              &lt;reportElement x="7" y="16" width="322" height="19" uuid="f28c3fc0-6d00-4437-a185-febccf94e91f"/&gt;
              &lt;textElement markup="none"/&gt;
              &lt;textFieldExpression&gt;&lt;![CDATA[$F{idLb} +" - "+ $F{LB_LangBezeichnung}]]&gt;&lt;/textFieldExpression&gt;
          &lt;/textField&gt;
          &lt;textField bookmarkLevel="1"&gt;
              &lt;reportElement x="8" y="32" width="321" height="20" uuid="705007c1-4bfa-483a-a113-887cf7fd6488"/&gt;
              &lt;textFieldExpression&gt;&lt;![CDATA[$F{KN_Id}+": "+$F{KN_BezeichnungAlleinstehendKurz}]]&gt;&lt;/textFieldExpression&gt;
              &lt;anchorNameExpression&gt;&lt;![CDATA[$F{KN_Id}+":"+$F{nameAlleinstehend}]]&gt;&lt;/anchorNameExpression&gt;
          &lt;/textField&gt;
          &lt;image hAlign="Center"&gt;
              &lt;reportElement x="480" y="6" width="50" height="50" uuid="3f5fe998-e94e-4280-af71-7f7163878156"&gt;
                  &lt;printWhenExpression&gt;&lt;![CDATA[$F{IMG_ID} == 1]]&gt;&lt;/printWhenExpression&gt;
              &lt;/reportElement&gt;
              &lt;imageExpression&gt;&lt;![CDATA[$F{Image}]]&gt;&lt;/imageExpression&gt;
          &lt;/image&gt;
      &lt;/band&gt;
  &lt;/pageHeader&gt;
  &lt;columnHeader&gt;
      &lt;band splitType="Stretch"/&gt;
  &lt;/columnHeader&gt;
  &lt;detail&gt;
      &lt;band height="345"&gt;
          &lt;printWhenExpression&gt;&lt;![CDATA[new Boolean($V{id_COUNT}.intValue()==1)]]&gt;&lt;/printWhenExpression&gt;
          &lt;frame&gt;
              &lt;reportElement positionType="Float" stretchType="RelativeToTallestObject" x="8" y="40" width="292" height="220" uuid="55ca2869-dd02-48a5-a9bf-90b538ea22a6"/&gt;
              &lt;frame&gt;
                  &lt;reportElement positionType="Float" x="0" y="0" width="280" height="21" printWhenGroupChanges="id" uuid="255952d3-ed97-4615-926f-e7e89560d64a"/&gt;
                  &lt;textField isStretchWithOverflow="true"&gt;
                      &lt;reportElement key="" positionType="Float" x="99" y="0" width="181" height="21" printWhenGroupChanges="id" uuid="83851dcf-a0b2-44df-9117-0c5487b16260"&gt;
                          &lt;property name="net.sf.jasperreports.export.json.path" value="AK.id"/&gt;
                          &lt;property name="net.sf.jasperreports.export.json.repeat.value" value="true"/&gt;
                      &lt;/reportElement&gt;
                      &lt;box&gt;
                          &lt;topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                      &lt;/box&gt;
                      &lt;textElement&gt;
                          &lt;paragraph leftIndent="1"/&gt;
                      &lt;/textElement&gt;
                      &lt;textFieldExpression&gt;&lt;![CDATA[$F{KN_Id}]]&gt;&lt;/textFieldExpression&gt;
                  &lt;/textField&gt;
                  &lt;staticText&gt;
                      &lt;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"&gt;
                          &lt;property name="com.jaspersoft.studio.unit.x" value="pixel"/&gt;
                      &lt;/reportElement&gt;
                      &lt;box&gt;
                          &lt;topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/&gt;
                      &lt;/box&gt;
                      &lt;text&gt;&lt;![CDATA[AK_ID]]&gt;&lt;/text&gt;
                  &lt;/staticText&gt;
              &lt;/frame&gt;
              &lt;frame&gt;
                  &lt;reportElement positionType="Float" x="0" y="21" width="280" height="21" printWhenGroupChanges="id" uuid="0879346c-a263-431d-8e2d-8d2a1cd0e67c"/&gt;
                  &lt;staticText&gt;
                      &lt;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"/&gt;
                      &lt;box&gt;
                          &lt;topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/&gt;
                      &lt;/box&gt;
                      &lt;text&gt;&lt;![CDATA[Präfix]]&gt;&lt;/text&gt;
                  &lt;/staticText&gt;
                  &lt;textField isStretchWithOverflow="true"&gt;
                      &lt;reportElement key="" positionType="Float" x="99" y="0" width="181" height="21" printWhenGroupChanges="id" uuid="f38998f8-8dc7-4ccc-8066-0cfe5e7ab876"&gt;
                          &lt;property name="net.sf.jasperreports.export.json.path" value="qi.praefix"/&gt;
                          &lt;property name="net.sf.jasperreports.export.json.repeat.value" value="true"/&gt;
                      &lt;/reportElement&gt;
                      &lt;box&gt;
                          &lt;topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                      &lt;/box&gt;
                      &lt;textElement&gt;
                          &lt;paragraph leftIndent="1"/&gt;
                      &lt;/textElement&gt;
                      &lt;textFieldExpression&gt;&lt;![CDATA[$F{QI_Praefix}]]&gt;&lt;/textFieldExpression&gt;
                  &lt;/textField&gt;
              &lt;/frame&gt;
              &lt;frame&gt;
                  &lt;reportElement positionType="Float" x="0" y="42" width="280" height="30" printWhenGroupChanges="id" uuid="92186cbd-4a98-4c6e-9b51-0dfe52d5ff21"/&gt;
                  &lt;textField isStretchWithOverflow="true"&gt;
                      &lt;reportElement positionType="Float" x="99" y="0" width="181" height="30" printWhenGroupChanges="id" uuid="4818fc44-cde3-40ed-8d77-a6dd71b89f79"&gt;
                          &lt;property name="net.sf.jasperreports.export.json.path" value="begruendung.relevanz"/&gt;
                          &lt;property name="net.sf.jasperreports.export.json.repeat.value" value="true"/&gt;
                          &lt;property name="com.jaspersoft.studio.unit.x" value="pixel"/&gt;
                          &lt;property name="com.jaspersoft.studio.unit.height" value="pixel"/&gt;
                      &lt;/reportElement&gt;
                      &lt;box&gt;
                          &lt;topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                      &lt;/box&gt;
                      &lt;textElement markup="html"&gt;
                          &lt;paragraph leftIndent="1"/&gt;
                      &lt;/textElement&gt;
                      &lt;textFieldExpression&gt;&lt;![CDATA["&lt;b&gt;Relevanz&lt;/b&gt;&lt;br&gt;" +($F{KN_Zusatzinfo_DV_Relevanz} !=null ? $F{KN_Zusatzinfo_DV_Relevanz} : "-")+"&lt;br&gt;&lt;b&gt;Hypothese&lt;/b&gt;&lt;br&gt;" + ($F{KN_Zusatzinfo_DV_Hypothese} !=null ? $F{KN_Zusatzinfo_DV_Hypothese}: "-")]]&gt;&lt;/textFieldExpression&gt;
                  &lt;/textField&gt;
                  &lt;staticText&gt;
                      &lt;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"&gt;
                          &lt;property name="com.jaspersoft.studio.unit.x" value="pixel"/&gt;
                      &lt;/reportElement&gt;
                      &lt;box&gt;
                          &lt;topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                      &lt;/box&gt;
                      &lt;textElement&gt;
                          &lt;paragraph lineSpacing="Single"/&gt;
                      &lt;/textElement&gt;
                      &lt;text&gt;&lt;![CDATA[Begründung für die Auswahl]]&gt;&lt;/text&gt;
                  &lt;/staticText&gt;
              &lt;/frame&gt;
              &lt;frame&gt;
                  &lt;reportElement positionType="Float" x="0" y="72" width="280" height="27" printWhenGroupChanges="id" uuid="91d6b54a-bcd4-4737-8208-7dcd9e388ea4"&gt;
                      &lt;property name="com.jaspersoft.studio.unit.x" value="pixel"/&gt;
                  &lt;/reportElement&gt;
                  &lt;textField isStretchWithOverflow="true"&gt;
                      &lt;reportElement positionType="Float" x="99" y="0" width="181" height="27" printWhenGroupChanges="id" uuid="883db6cf-5cc6-4e32-a4cd-54bdf86b97df"&gt;
                          &lt;property name="com.jaspersoft.studio.unit.x" value="pixel"/&gt;
                          &lt;property name="com.jaspersoft.studio.unit.y" value="pixel"/&gt;
                      &lt;/reportElement&gt;
                      &lt;box&gt;
                          &lt;topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                      &lt;/box&gt;
                      &lt;textElement rotation="None"&gt;
                          &lt;paragraph leftIndent="1"/&gt;
                      &lt;/textElement&gt;
                      &lt;textFieldExpression&gt;&lt;![CDATA[($F{KN_Zusatzinfo_DV_Indikatorbezug} !=null ? $F{KN_Zusatzinfo_DV_Indikatorbezug} : "-")]]&gt;&lt;/textFieldExpression&gt;
                  &lt;/textField&gt;
                  &lt;staticText&gt;
                      &lt;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"&gt;
                          &lt;property name="com.jaspersoft.studio.unit.x" value="pixel"/&gt;
                      &lt;/reportElement&gt;
                      &lt;box&gt;
                          &lt;topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/&gt;
                      &lt;/box&gt;
                      &lt;text&gt;&lt;![CDATA[Bezug zu anderen Indikatoren]]&gt;&lt;/text&gt;
                  &lt;/staticText&gt;
              &lt;/frame&gt;
              &lt;frame&gt;
                  &lt;reportElement positionType="Float" x="0" y="99" width="280" height="27" printWhenGroupChanges="id" uuid="be213a60-4cd9-4f4a-972b-edfbf7b408c9"/&gt;
                  &lt;textField isStretchWithOverflow="true"&gt;
                      &lt;reportElement positionType="Float" x="99" y="0" width="181" height="27" printWhenGroupChanges="id" uuid="261644b6-bbdb-4528-9f25-7fb23e98bf99"&gt;
                          &lt;property name="com.jaspersoft.studio.unit.width" value="pixel"/&gt;
                          &lt;property name="com.jaspersoft.studio.unit.height" value="pixel"/&gt;
                          &lt;property name="com.jaspersoft.studio.unit.y" value="pixel"/&gt;
                      &lt;/reportElement&gt;
                      &lt;box&gt;
                          &lt;topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                      &lt;/box&gt;
                      &lt;textElement&gt;
                          &lt;paragraph leftIndent="1"/&gt;
                      &lt;/textElement&gt;
                      &lt;textFieldExpression&gt;&lt;![CDATA[$F{bewertungsArtTypNameKurz}]]&gt;&lt;/textFieldExpression&gt;
                  &lt;/textField&gt;
                  &lt;staticText&gt;
                      &lt;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"&gt;
                          &lt;property name="com.jaspersoft.studio.unit.height" value="pixel"/&gt;
                          &lt;property name="com.jaspersoft.studio.unit.x" value="pixel"/&gt;
                      &lt;/reportElement&gt;
                      &lt;box&gt;
                          &lt;topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/&gt;
                      &lt;/box&gt;
                      &lt;text&gt;&lt;![CDATA[Bewertungsart]]&gt;&lt;/text&gt;
                  &lt;/staticText&gt;
              &lt;/frame&gt;
              &lt;frame&gt;
                  &lt;reportElement positionType="Float" x="0" y="127" width="280" height="27" printWhenGroupChanges="id" uuid="626fe004-8942-4655-8c64-4022728e65e9"/&gt;
                  &lt;textField isStretchWithOverflow="true"&gt;
                      &lt;reportElement positionType="Float" x="99" y="0" width="181" height="27" printWhenGroupChanges="id" uuid="3ea786ed-6ce2-4ce7-84af-b4b7d29cc3b7"&gt;
                          &lt;property name="com.jaspersoft.studio.unit.width" value="pixel"/&gt;
                          &lt;property name="com.jaspersoft.studio.unit.height" value="pixel"/&gt;
                          &lt;property name="com.jaspersoft.studio.unit.y" value="pixel"/&gt;
                      &lt;/reportElement&gt;
                      &lt;box&gt;
                          &lt;topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                      &lt;/box&gt;
                      &lt;textElement&gt;
                          &lt;paragraph leftIndent="1"/&gt;
                      &lt;/textElement&gt;
                      &lt;textFieldExpression&gt;&lt;![CDATA[$F{mindesanzahlZaeler}]]&gt;&lt;/textFieldExpression&gt;
                  &lt;/textField&gt;
                  &lt;staticText&gt;
                      &lt;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"&gt;
                          &lt;property name="com.jaspersoft.studio.unit.height" value="pixel"/&gt;
                          &lt;property name="com.jaspersoft.studio.unit.x" value="pixel"/&gt;
                      &lt;/reportElement&gt;
                      &lt;box&gt;
                          &lt;topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/&gt;
                      &lt;/box&gt;
                      &lt;text&gt;&lt;![CDATA[Mindestanzahl Zähler]]&gt;&lt;/text&gt;
                  &lt;/staticText&gt;
              &lt;/frame&gt;
              &lt;frame&gt;
                  &lt;reportElement positionType="Float" x="0" y="154" width="280" height="27" uuid="f2f30758-914b-4990-b508-644cabb06f3f"/&gt;
                  &lt;textField isStretchWithOverflow="true"&gt;
                      &lt;reportElement positionType="Float" x="99" y="0" width="181" height="27" printWhenGroupChanges="id" uuid="77c50b2a-a9ec-4225-8361-4daa6dc9d97e"&gt;
                          &lt;property name="com.jaspersoft.studio.unit.width" value="pixel"/&gt;
                          &lt;property name="com.jaspersoft.studio.unit.height" value="pixel"/&gt;
                          &lt;property name="com.jaspersoft.studio.unit.y" value="pixel"/&gt;
                      &lt;/reportElement&gt;
                      &lt;box&gt;
                          &lt;topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                      &lt;/box&gt;
                      &lt;textElement&gt;
                          &lt;paragraph leftIndent="1"/&gt;
                      &lt;/textElement&gt;
                      &lt;textFieldExpression&gt;&lt;![CDATA[$F{KN_Vergleichbarkeit_Vorjahr}]]&gt;&lt;/textFieldExpression&gt;
                  &lt;/textField&gt;
                  &lt;staticText&gt;
                      &lt;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"&gt;
                          &lt;property name="com.jaspersoft.studio.unit.height" value="pixel"/&gt;
                          &lt;property name="com.jaspersoft.studio.unit.x" value="pixel"/&gt;
                      &lt;/reportElement&gt;
                      &lt;box&gt;
                          &lt;topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/&gt;
                      &lt;/box&gt;
                      &lt;text&gt;&lt;![CDATA[Vergleichbarkeit mit Vorjahr]]&gt;&lt;/text&gt;
                  &lt;/staticText&gt;
              &lt;/frame&gt;
              &lt;frame&gt;
                  &lt;reportElement positionType="Float" x="0" y="182" width="280" height="27" uuid="3a70786a-ab1b-4193-8087-bcf9f363116a"/&gt;
                  &lt;textField isStretchWithOverflow="true" isBlankWhenNull="false"&gt;
                      &lt;reportElement positionType="Float" x="99" y="-1" width="181" height="27" printWhenGroupChanges="id" uuid="0d48b38a-07e8-42e7-89e8-e0580651028e"&gt;
                          &lt;property name="com.jaspersoft.studio.unit.width" value="pixel"/&gt;
                          &lt;property name="com.jaspersoft.studio.unit.height" value="pixel"/&gt;
                          &lt;property name="com.jaspersoft.studio.unit.y" value="pixel"/&gt;
                      &lt;/reportElement&gt;
                      &lt;box&gt;
                          &lt;topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                      &lt;/box&gt;
                      &lt;textElement&gt;
                          &lt;paragraph leftIndent="1"/&gt;
                      &lt;/textElement&gt;
                      &lt;textFieldExpression&gt;&lt;![CDATA[$F{mindesanzahlNenner}]]&gt;&lt;/textFieldExpression&gt;
                  &lt;/textField&gt;
                  &lt;staticText&gt;
                      &lt;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"&gt;
                          &lt;property name="com.jaspersoft.studio.unit.height" value="pixel"/&gt;
                          &lt;property name="com.jaspersoft.studio.unit.x" value="pixel"/&gt;
                      &lt;/reportElement&gt;
                      &lt;box&gt;
                          &lt;topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/&gt;
                          &lt;rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/&gt;
                      &lt;/box&gt;
                      &lt;text&gt;&lt;![CDATA[Mindestanzahl Nenner]]&gt;&lt;/text&gt;
                  &lt;/staticText&gt;
              &lt;/frame&gt;
          &lt;/frame&gt;
          &lt;textField isStretchWithOverflow="true" hyperlinkType="" hyperlinkTarget=""&gt;
              &lt;reportElement mode="Transparent" x="0" y="4" width="340" height="6" printWhenGroupChanges="id" uuid="56a6e5f3-fd57-436e-8acb-8dbc1acbb220"&gt;
                  &lt;printWhenExpression&gt;&lt;![CDATA[1==0]]&gt;&lt;/printWhenExpression&gt;
              &lt;/reportElement&gt;
              &lt;textElement markup="html"/&gt;
              &lt;textFieldExpression&gt;&lt;![CDATA[$F{KN_Id}+":"+$F{nameAlleinstehend}]]&gt;&lt;/textFieldExpression&gt;
              &lt;hyperlinkReferenceExpression&gt;&lt;![CDATA[]]&gt;&lt;/hyperlinkReferenceExpression&gt;
          &lt;/textField&gt;
          &lt;staticText&gt;
              &lt;reportElement x="11" y="14" width="78" height="16" uuid="17d269d4-d7fa-44ef-8b00-d1abe0ecb92c"/&gt;
              &lt;textElement&gt;
                  &lt;font size="12" isBold="true"/&gt;
              &lt;/textElement&gt;
              &lt;text&gt;&lt;![CDATA[Berechnung]]&gt;&lt;/text&gt;
          &lt;/staticText&gt;
      &lt;/band&gt;
  &lt;/detail&gt;
  &lt;columnFooter&gt;
      &lt;band splitType="Stretch"&gt;
          &lt;property name="com.jaspersoft.studio.unit.height" value="pixel"/&gt;
      &lt;/band&gt;
  &lt;/columnFooter&gt;
  &lt;pageFooter&gt;
      &lt;band height="54" splitType="Stretch"&gt;
          &lt;staticText&gt;
              &lt;reportElement x="0" y="20" width="410" height="20" uuid="0744ba3c-69d3-4220-b201-72dabdeb5038"/&gt;
              &lt;textElement&gt;
                  &lt;font size="8"/&gt;
              &lt;/textElement&gt;
              &lt;text&gt;&lt;![CDATA[ins]]&gt;&lt;/text&gt;
          &lt;/staticText&gt;
          &lt;textField evaluationTime="Master"&gt;
              &lt;reportElement x="481" y="18" width="69" height="24" uuid="5789c6a7-2ca2-4ba9-bd13-1b56ddcb7091"/&gt;
              &lt;textFieldExpression&gt;&lt;![CDATA["Seite "+$V{MASTER_CURRENT_PAGE}+" von"+$V{MASTER_TOTAL_PAGES}]]&gt;&lt;/textFieldExpression&gt;
          &lt;/textField&gt;
      &lt;/band&gt;
  &lt;/pageFooter&gt;
  &lt;/jasperReport&gt;
  </code></pre>
  
  <p>And here is the report book:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;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"&gt;
  &lt;property name="com.jaspersoft.studio.data.defaultdataadapter"  value="KennzahlReferenz2015_QIBericht"/&gt;
  &lt;property name="net.sf.jasperreports.print.create.bookmarks" value="true"/&gt;
  &lt;property name="com.jaspersoft.studio.book.group.cover.header" value="Cover     and Table of Contents"/&gt;
  &lt;property name="com.jaspersoft.studio.book.group.cover.footer" value="Backcover"/&gt;
  &lt;property name="com.jaspersoft.studio.data.sql.tables" value=""/&gt;
  &lt;queryString&gt;
      &lt;![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]]&gt;
  &lt;/queryString&gt;
  &lt;field name="KN_Id" class="java.lang.Integer"/&gt;
  &lt;field name="nameAlleinstehend" class="java.lang.String"/&gt;
  &lt;field name="Image" class="java.awt.Image"/&gt;
  &lt;group name="cover"&gt;
      &lt;groupHeader&gt;
          &lt;part uuid="7aed05b9-1301-4a53-b47e-34289560bc0c"&gt;
              &lt;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"&gt;
                  &lt;subreportExpression&gt;&lt;![CDATA["qidbReport_cover.jasper"]]&gt;&lt;/subreportExpression&gt;
              &lt;/p:subreportPart&gt;
          &lt;/part&gt;
          &lt;part evaluationTime="Report" uuid="56ab525c-754f-4f48-a52c-7cc23934be3d"&gt;
              &lt;property name="net.sf.jasperreports.bookmarks.data.source.parameter" value="REPORT_DATA_SOURCE"/&gt;
              &lt;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"&gt;
                  &lt;subreportExpression&gt;&lt;![CDATA["qidbReport_toc.jasper"]]&gt;&lt;/subreportExpression&gt;
              &lt;/p:subreportPart&gt;
          &lt;/part&gt;
      &lt;/groupHeader&gt;
      &lt;groupFooter&gt;
          &lt;part uuid="88decbbe-63ad-45cc-9e03-5dadc50004d5"&gt;
              &lt;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"&gt;
                  &lt;subreportExpression&gt;&lt;![CDATA["qidbReport_backcover.jasper"]]&gt;&lt;/subreportExpression&gt;
              &lt;/p:subreportPart&gt;
          &lt;/part&gt;
      &lt;/groupFooter&gt;
  &lt;/group&gt;
  &lt;detail&gt;
      &lt;part uuid="fbf811eb-2c43-48b9-a88b-ae94453264df"&gt;
          &lt;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"&gt;
              &lt;subreportParameter name="REPORT_CONNECTION"&gt;
                  &lt;subreportParameterExpression&gt;&lt;![CDATA[$P{REPORT_CONNECTION}]]&gt;&lt;/subreportParameterExpression&gt;
              &lt;/subreportParameter&gt;
              &lt;subreportExpression&gt;&lt;![CDATA["direktRechrDV.jasper"]]&gt;&lt;/subreportExpression&gt;
          &lt;/p:subreportPart&gt;
      &lt;/part&gt;
  &lt;/detail&gt;
  &lt;/jasperReport&gt;
  </code></pre>
  
  <p>These are the outputs from JR and DB:
  Jasper:</p>
  
  <p><a href="https://i.stack.imgur.com/3fVBs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3fVBs.png" alt="JR"></a></p>
  
  <p>DB:</p>
  
  <p><a href="https://i.stack.imgur.com/QSRFv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QSRFv.png" alt="DB"></a></p>