I'am using Jasper studio to generate pdf template. I added a table in this template without sources or database conenction but in jasper does not show the table. Below is my jrxml file:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.11.0.final using JasperReports Library version 6.11.0-0c4056ccaa4d25a5a8c45672d2f764ea3498bebb -->
<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="Blank_A4" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="06cb70de-815a-4623-b868-91a92feca771">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<style name="Table_TH" mode="Opaque" backcolor="#549BDE">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table_CH" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="Dataset1" uuid="d011bfa0-d2bd-475d-b7d1-4d69deec36be">
<queryString>
<![CDATA[]]>
</queryString>
</subDataset>
<subDataset name="Dataset2" uuid="563537d5-3b04-4cb9-93d6-4eb48c6fb5c7">
<queryString>
<![CDATA[]]>
</queryString>
</subDataset>
<subDataset name="Dataset3" uuid="fa68464d-99c7-4751-8e25-f173ce78f908">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<queryString>
<![CDATA[]]>
</queryString>
</subDataset>
<subDataset name="tableActiviteValide" uuid="bc90850c-a424-455b-8cb5-dd5df5282de5">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<queryString>
<![CDATA[]]>
</queryString>
</subDataset>
<parameter name="codeTournee" class="java.lang.String"/>
<parameter name="dateTournee" class="java.lang.String"/>
<parameter name="heureDepartTournee" class="java.lang.String"/>
<parameter name="heureDuPremierPoint" class="java.lang.String"/>
<parameter name="nbPointsPrevu" class="java.lang.String"/>
<parameter name="nomChauffeur" class="java.lang.String"/>
<parameter name="respectETA" class="java.lang.String"/>
<parameter name="statutTournee" class="java.lang.String"/>
<queryString>
<![CDATA[]]>
</queryString>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="51" splitType="Stretch">
<staticText>
<reportElement x="120" y="-16" width="320" height="66" uuid="240b4bfe-6b32-4a96-8bf1-69ba08f35e74"/>
<textElement textAlignment="Center">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Contôle retour collecte
Impression de la synthèse de l'activité]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="50" splitType="Stretch">
<textField>
<reportElement x="-16" y="10" width="237" height="40" uuid="9aa786c1-e331-4790-99cc-d509a0f8626c"/>
<textFieldExpression><![CDATA[new java.lang.String("Impression de ") + java.time.format.DateTimeFormatter.ofPattern("dd/MM/YYYY").format(java.time.LocalDate.now()) + new java.lang.String(" à ") + java.time.format.DateTimeFormatter.ofPattern("HH:mm").format(java.time.LocalTime.now())]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<columnHeader>
<band height="220" splitType="Stretch">
<rectangle>
<reportElement x="10" y="20" width="535" height="190" uuid="58a48853-5a63-485a-8dd5-a4e3a36076c8"/>
<graphicElement>
<pen lineStyle="Solid"/>
</graphicElement>
</rectangle>
<staticText>
<reportElement x="30" y="48" width="60" height="20" uuid="ac6227f3-aa2c-4355-93c2-a3a67aacd2b1"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Tournée:]]></text>
</staticText>
<textField>
<reportElement x="169" y="48" width="60" height="20" uuid="3e0708e0-cc0f-4282-9e60-fa962be46bc9">
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement>
<font isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{codeTournee}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="30" y="80" width="60" height="20" uuid="a794c118-84d7-4f73-a87c-42366cc1d5fa"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Date:]]></text>
</staticText>
<staticText>
<reportElement x="30" y="110" width="120" height="20" uuid="fdfc42f2-30ca-4302-bb43-2e0b453cedf6"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Heure de départ:]]></text>
</staticText>
<staticText>
<reportElement x="30" y="140" width="136" height="20" uuid="f7abe915-02c3-4b85-839a-b528e4d7692b"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Heure du 1er point:]]></text>
</staticText>
<staticText>
<reportElement x="30" y="170" width="136" height="20" uuid="331e25b0-d0ef-461b-974b-f8a676b42505"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Nb points prévus:]]></text>
</staticText>
<textField>
<reportElement x="169" y="80" width="60" height="20" uuid="d75802b2-b117-4b79-9929-fe76fa8a594b">
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
</reportElement>
<textFieldExpression><![CDATA[$P{dateTournee}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="169" y="110" width="60" height="20" uuid="1264ce76-8691-4b1e-9fad-0bb2ec2b5780">
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
</reportElement>
<textFieldExpression><![CDATA[$P{heureDepartTournee}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="169" y="140" width="60" height="20" uuid="501a135a-f70c-4572-b9a1-becaada10c91">
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textFieldExpression><![CDATA[$P{heureDuPremierPoint}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="169" y="170" width="60" height="20" uuid="6be68507-0e04-439a-a94e-3fb29c6b046f">
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textFieldExpression><![CDATA[$P{nbPointsPrevu}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="300" y="48" width="60" height="20" uuid="d2e71c08-f045-4d9a-a478-eb2814ae58ab"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Nom:]]></text>
</staticText>
<textField>
<reportElement x="400" y="48" width="60" height="20" uuid="e8878870-3bcc-4237-8ba7-fb1eecd96482">
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement>
<font isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{nomChauffeur}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="300" y="140" width="90" height="20" uuid="91532fe1-2320-4f0f-ab7d-c69d98198911"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[RespectETA:]]></text>
</staticText>
<staticText>
<reportElement x="300" y="170" width="90" height="20" uuid="3e2d848e-9be5-47fb-aa9a-47c7634869fa"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Statut Tournée:]]></text>
</staticText>
<textField>
<reportElement x="400" y="140" width="60" height="20" uuid="92b863f7-011e-4a25-8e23-0d89066db13a">
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement>
<font isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{respectETA}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="400" y="170" width="60" height="20" uuid="9091a71f-fa56-413a-b0ed-31d57c34f1e9">
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement>
<font isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{respectETA}]]></textFieldExpression>
</textField>
</band>
</columnHeader>
<detail>
<band height="353" splitType="Stretch">
<staticText>
<reportElement x="10" y="4" width="534" height="66" uuid="8d8baf3e-51bf-436a-9691-dfda004dce54"/>
<text><![CDATA[Attention, les informations données à titre d'information pour permettre de mieux gérer l'activité sont susceptibles d'être modifiées à la suite du contrôle back-office, l'agence reste à votre disposition.]]></text>
</staticText>
<componentElement>
<reportElement x="20" y="80" width="311" height="85" uuid="52b7823f-9442-433e-b665-1398b400ae88">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
<property name="com.jaspersoft.studio.table.style.table_header" value="Table_TH"/>
<property name="com.jaspersoft.studio.table.style.column_header" value="Table_CH"/>
<property name="com.jaspersoft.studio.table.style.detail" value="Table_TD"/>
</reportElement>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="tableActiviteValide" uuid="5ac2165e-840c-4a99-9511-4bd1a604f544">
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
<jr:column width="40" uuid="ee0f7403-3157-4b14-aeaa-c8fb9dc5a97b">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Colonne1"/>
<jr:tableHeader style="Table_TH" height="60" rowSpan="2"/>
<jr:tableFooter style="Table_TH" height="30" rowSpan="1"/>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1"/>
<jr:columnFooter style="Table_CH" height="30" rowSpan="1"/>
<jr:detailCell style="Table_TD" height="30"/>
</jr:column>
<jr:column width="40" uuid="a9e963ba-1a80-4a5d-85b8-1d0d14e0ff05">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Colonne2"/>
<jr:tableHeader style="Table_TH" height="60" rowSpan="2"/>
<jr:tableFooter style="Table_TH" height="30" rowSpan="1"/>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1"/>
<jr:columnFooter style="Table_CH" height="30" rowSpan="1"/>
<jr:detailCell style="Table_TD" height="30"/>
</jr:column>
<jr:column width="40" uuid="78afc7bc-a1f8-4fa8-aeac-311be51643c4">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Colonne3"/>
<jr:tableHeader style="Table_TH" height="60" rowSpan="2"/>
<jr:tableFooter style="Table_TH" height="30" rowSpan="1"/>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1"/>
<jr:columnFooter style="Table_CH" height="30" rowSpan="1"/>
<jr:detailCell style="Table_TD" height="30"/>
</jr:column>
<jr:columnGroup width="80" uuid="7c6c7ce4-2a9a-4735-b4ce-55e99ff0379f">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Colonnes [2]"/>
<jr:tableHeader style="Table_TH" height="30" rowSpan="1"/>
<jr:column width="40" uuid="8033f192-d8fb-46f2-a87f-5acba54f6138">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Colonne4"/>
<jr:tableHeader style="Table_TH" height="30" rowSpan="1"/>
<jr:tableFooter style="Table_TH" height="30" rowSpan="1"/>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1"/>
<jr:columnFooter style="Table_CH" height="30" rowSpan="1"/>
<jr:detailCell style="Table_TD" height="30"/>
</jr:column>
<jr:column width="40" uuid="5f31f40c-f884-4ec1-a2f7-4cda37699e00">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Colonne5"/>
<jr:tableHeader style="Table_TH" height="30" rowSpan="1"/>
<jr:tableFooter style="Table_TH" height="30" rowSpan="1"/>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1"/>
<jr:columnFooter style="Table_CH" height="30" rowSpan="1"/>
<jr:detailCell style="Table_TD" height="30"/>
</jr:column>
</jr:columnGroup>
<jr:column width="40" uuid="723c94fd-6ccc-4f10-b827-18477cc941fb">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Colonne6"/>
<jr:tableHeader style="Table_TH" height="60" rowSpan="2"/>
<jr:tableFooter style="Table_TH" height="30" rowSpan="1"/>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1"/>
<jr:columnFooter style="Table_CH" height="30" rowSpan="1"/>
<jr:detailCell style="Table_TD" height="30"/>
</jr:column>
<jr:column width="40" uuid="4aea6eaf-a426-4be7-829a-a9b94c1b5777">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Colonne7"/>
<jr:tableHeader style="Table_TH" height="60" rowSpan="2"/>
<jr:tableFooter style="Table_TH" height="30" rowSpan="1"/>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1"/>
<jr:columnFooter style="Table_CH" height="30" rowSpan="1"/>
<jr:detailCell style="Table_TD" height="30"/>
</jr:column>
</jr:table>
</componentElement>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>
There is no problem that had been shown in my report and the table is not visible in my template. How Can i resolve this?
Thank's!
You have to give some data to the table, otherwise jasper don't show it because nothing is to show when you give no data.
Related
I have a requirement to create a table using JSON data using Jasperstudio 6.2.12 and export it to .xlsx format. I'm able to create the table as shown below:
The requirement I have is to iterate the values in A, B, C, and D columns based on the number of rows in the E and F columns. The expected output is:
The JSON data I've used to print the table is :
{
"root": [{
"firstName": "John",
"lastName": "Doe",
"accounts": [{
"bank": "LLOYDS",
"accountNumber": 123456,
"references": [{
"name": "Eva Doe",
"refAccountNumber": 6549873
},
{
"name": "Robin Doe",
"refAccountNumber": 3216545
},
{
"name": "Peter Doe",
"refAccountNumber": 9876549
}
]
}]
},
{
"firstName": "James",
"lastName": "Doe",
"accounts": [{
"bank": "HSBC",
"accountNumber": 654321,
"references": [{
"name": "Sam Doe",
"refAccountNumber": 6549873
},
{
"name": "Roger Doe",
"refAccountNumber": 3216545
},
{
"name": "Jason Doe",
"refAccountNumber": 9876549
}
]
}]
}
]}
JRXML:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.13.0.final using JasperReports Library version 6.13.0-46ada4d1be8f3c5985fd0b6146f3ed44caed6f05 -->
<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="accounts" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="066cfa9f-bcf0-4095-8d82-a5ef1cb8632d">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="Test"/>
<property name="net.sf.jasperreports.export.xls.one.page.per.sheet" value="true"/>
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.rows" value="true"/>
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.columns" value="true"/>
<property name="net.sf.jasperreports.export.xls.white.page.background" value="false"/>
<property name="net.sf.jasperreports.export.xls.detect.cell.type" value="true"/>
<property name="net.sf.jasperreports.export.xls.ignore.graphics" value="false"/>
<property name="net.sf.jasperreports.page.break.no.pagination" value="apply"/>
<property name="net.sf.jasperreports.export.xls.sheet.names.all" value="Accounts"/>
<property name="net.sf.jasperreports.export.xls.freeze.row" value="1"/>
<property name="net.sf.jasperreports.print.keep.full.text" value="true"/>
<property name="net.sf.jasperreports.exports.xls.font.size.fix.enabled" value="false"/>
<property name="maximumRowsPerSheet" value="0"/>
<style name="Table_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="AccountsDataset" uuid="73085770-27bc-42cb-b4db-edc97074de2c">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="Test"/>
<queryString language="json">
<![CDATA[root.accounts]]>
</queryString>
<field name="bank" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="bank"/>
<fieldDescription><![CDATA[bank]]></fieldDescription>
</field>
<field name="accountNumber" class="java.lang.Integer">
<property name="net.sf.jasperreports.json.field.expression" value="accountNumber"/>
<fieldDescription><![CDATA[accountNumber]]></fieldDescription>
</field>
<field name="accoutType" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="accoutType"/>
<fieldDescription><![CDATA[accoutType]]></fieldDescription>
</field>
<field name="references" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="references"/>
<fieldDescription><![CDATA[references]]></fieldDescription>
</field>
</subDataset>
<subDataset name="ReferencesDataset" uuid="b23c5f84-b106-4d89-a5d4-6287aa8bbdf7">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="Test"/>
<queryString language="json">
<![CDATA[root.accounts.references]]>
</queryString>
<field name="name" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="name"/>
<fieldDescription><![CDATA[name]]></fieldDescription>
</field>
<field name="refAccountNumber" class="java.lang.Integer">
<property name="net.sf.jasperreports.json.field.expression" value="refAccountNumber"/>
<fieldDescription><![CDATA[refAccountNumber]]></fieldDescription>
</field>
</subDataset>
<subDataset name="MainDataset" uuid="ab297ea1-81e6-4a6f-b90c-4ce1fb9521a2">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="Test"/>
<queryString language="json">
<![CDATA[root]]>
</queryString>
<field name="firstName" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="firstName"/>
<fieldDescription><![CDATA[firstName]]></fieldDescription>
</field>
<field name="lastName" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="lastName"/>
<fieldDescription><![CDATA[lastName]]></fieldDescription>
</field>
<field name="email" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="email"/>
<fieldDescription><![CDATA[email]]></fieldDescription>
</field>
<field name="accounts" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="accounts"/>
<fieldDescription><![CDATA[accounts]]></fieldDescription>
</field>
</subDataset>
<queryString language="json">
<![CDATA[]]>
</queryString>
<field name="root" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="root"/>
<fieldDescription><![CDATA[root]]></fieldDescription>
</field>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="254" splitType="Stretch">
<componentElement>
<reportElement x="0" y="0" width="480" height="60" uuid="268fe625-e43f-48d5-90c7-f396d09cd88d">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
<property name="com.jaspersoft.studio.table.style.table_header" value="Table_TH"/>
<property name="com.jaspersoft.studio.table.style.column_header" value="Table_CH"/>
<property name="com.jaspersoft.studio.table.style.detail" value="Table_TD"/>
</reportElement>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="MainDataset" uuid="67830a07-2594-4532-ae34-96829b8046da">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("root")]]></dataSourceExpression>
</datasetRun>
<jr:column width="80" uuid="a8cf3aa0-1633-4f19-a908-6efbf55d2f75">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<staticText>
<reportElement x="0" y="0" width="80" height="30" uuid="b89609d4-5cbb-4f5b-b470-c9f9f4ad9d26"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[First Name]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField>
<reportElement x="0" y="0" width="80" height="30" uuid="ec954e2c-43e4-43ba-9005-03272b9daad5"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{firstName}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="80" uuid="e7f5cfca-a803-485d-be01-5d2f785fbf0b">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<staticText>
<reportElement x="0" y="0" width="80" height="30" uuid="0a2eb2ed-75b9-46c3-8751-871c5473c3e1"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Last Name]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField>
<reportElement x="0" y="0" width="80" height="30" uuid="767b9d15-53e5-4a0b-be8c-ec94fc6398f8"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{lastName}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="80" uuid="c7103510-df1d-4c31-a30f-9b726540dd7a">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column3"/>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<staticText>
<reportElement x="0" y="0" width="80" height="30" uuid="11192151-2c03-4590-91f7-87021b022301"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Bank]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<componentElement>
<reportElement x="0" y="0" width="80" height="30" uuid="8b2678af-1b87-49e6-aca2-af0cec3d7a46"/>
<jr:list printOrder="Vertical">
<datasetRun subDataset="AccountsDataset" uuid="faa7fa1c-7169-48fb-aac2-7483a2477998">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("accounts")]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="30" width="80">
<textField>
<reportElement x="0" y="0" width="80" height="30" uuid="97ec29f7-36f2-4ecc-9f30-3049e0648e97"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{bank}]]></textFieldExpression>
</textField>
</jr:listContents>
</jr:list>
</componentElement>
</jr:detailCell>
</jr:column>
<jr:column width="80" uuid="5a4bb23a-7d61-486b-91f8-b5150cb85817">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column4"/>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<staticText>
<reportElement x="0" y="0" width="80" height="30" uuid="30680d44-df3b-484e-b059-399e0a21b304"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Account Number]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<componentElement>
<reportElement x="0" y="0" width="80" height="30" uuid="d7780443-ba11-4d20-944d-4f8210a74506"/>
<jr:list printOrder="Vertical">
<datasetRun subDataset="AccountsDataset" uuid="2c245f1d-7a8f-46dc-85c3-737b5b0bc5a1">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("accounts")]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="30" width="80">
<textField>
<reportElement x="0" y="0" width="80" height="30" uuid="ba6b13f3-770d-4a02-b3f0-5d4293393cd3"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{accountNumber}]]></textFieldExpression>
</textField>
</jr:listContents>
</jr:list>
</componentElement>
</jr:detailCell>
</jr:column>
<jr:column width="80" uuid="0720c554-a0af-4192-a669-38cea560a2e2">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column5"/>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<staticText>
<reportElement x="0" y="0" width="80" height="30" uuid="98adb234-9003-4704-85e4-295538f4273c"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Ref Name]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<componentElement>
<reportElement x="0" y="0" width="80" height="30" uuid="faf83492-91ac-4a39-9483-512d6555c3d3"/>
<jr:list printOrder="Vertical">
<datasetRun subDataset="ReferencesDataset" uuid="832a218b-199c-4055-9891-0afaf629bf50">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("accounts.references")]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="30" width="80">
<textField>
<reportElement x="0" y="0" width="80" height="30" uuid="955502f3-afec-40aa-a8f8-b5e83d43bcbc"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
</textField>
</jr:listContents>
</jr:list>
</componentElement>
</jr:detailCell>
</jr:column>
<jr:column width="80" uuid="2aed257e-00f2-4594-a9ac-9b504262ee3e">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column6"/>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<staticText>
<reportElement x="0" y="0" width="80" height="30" uuid="be058bb0-b9f3-4b41-b074-c1f44350eb09"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Ref Account Number]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<componentElement>
<reportElement x="0" y="0" width="80" height="30" uuid="ed5f0c5e-8f14-4565-8159-b7528e035f3c"/>
<jr:list printOrder="Vertical">
<datasetRun subDataset="ReferencesDataset" uuid="2c2d0c12-930c-45c5-a3a1-f8228fc78d7f">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("accounts.references")]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="30" width="80">
<textField>
<reportElement x="0" y="0" width="80" height="30" uuid="59563298-0f0f-4b62-b263-511abb945d1a"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{refAccountNumber}]]></textFieldExpression>
</textField>
</jr:listContents>
</jr:list>
</componentElement>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</detail>
</jasperReport>
Please help me to iterate the values in A, B, C, and D columns based on the number of rows in the E and F columns and get the expected output. Thank you all so much!
The easiest way to do this is to use a single subdataset that has the fields from all levels of the JSON tree. To do that you'll have to switch to the JSONQL query executer, which allows you to map fields from the parent nodes of the ones selected by the data source.
Once you have all the fields in a single dataset, you can use a simple table to display them.
The report would look like this:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.13.0.final using JasperReports Library version 6.13.0-46ada4d1be8f3c5985fd0b6146f3ed44caed6f05 -->
<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="accounts" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="066cfa9f-bcf0-4095-8d82-a5ef1cb8632d">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="Test"/>
<property name="net.sf.jasperreports.export.xls.one.page.per.sheet" value="true"/>
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.rows" value="true"/>
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.columns" value="true"/>
<property name="net.sf.jasperreports.export.xls.white.page.background" value="false"/>
<property name="net.sf.jasperreports.export.xls.detect.cell.type" value="true"/>
<property name="net.sf.jasperreports.export.xls.ignore.graphics" value="false"/>
<property name="net.sf.jasperreports.page.break.no.pagination" value="apply"/>
<property name="net.sf.jasperreports.export.xls.sheet.names.all" value="Accounts"/>
<property name="net.sf.jasperreports.export.xls.freeze.row" value="1"/>
<property name="net.sf.jasperreports.print.keep.full.text" value="true"/>
<property name="net.sf.jasperreports.exports.xls.font.size.fix.enabled" value="false"/>
<property name="maximumRowsPerSheet" value="0"/>
<style name="Table_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="ReferencesDataset" uuid="b23c5f84-b106-4d89-a5d4-6287aa8bbdf7">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="Test"/>
<queryString language="jsonql">
<![CDATA[root.accounts.references]]>
</queryString>
<field name="firstName" class="java.lang.String">
<property name="net.sf.jasperreports.jsonql.field.expression" value="^^^^.firstName"/>
<fieldDescription><![CDATA[firstName]]></fieldDescription>
</field>
<field name="lastName" class="java.lang.String">
<property name="net.sf.jasperreports.jsonql.field.expression" value="^^^^.lastName"/>
<fieldDescription><![CDATA[lastName]]></fieldDescription>
</field>
<field name="bank" class="java.lang.String">
<property name="net.sf.jasperreports.jsonql.field.expression" value="^^.bank"/>
<fieldDescription><![CDATA[bank]]></fieldDescription>
</field>
<field name="accountNumber" class="java.lang.Integer">
<property name="net.sf.jasperreports.jsonql.field.expression" value="^^.accountNumber"/>
<fieldDescription><![CDATA[accountNumber]]></fieldDescription>
</field>
<field name="name" class="java.lang.String">
<property name="net.sf.jasperreports.jsonql.field.expression" value="name"/>
<fieldDescription><![CDATA[name]]></fieldDescription>
</field>
<field name="refAccountNumber" class="java.lang.Integer">
<property name="net.sf.jasperreports.jsonql.field.expression" value="refAccountNumber"/>
<fieldDescription><![CDATA[refAccountNumber]]></fieldDescription>
</field>
</subDataset>
<queryString language="jsonql">
<![CDATA[]]>
</queryString>
<field name="root" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="root"/>
<fieldDescription><![CDATA[root]]></fieldDescription>
</field>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="254" splitType="Stretch">
<componentElement>
<reportElement x="0" y="0" width="480" height="60" uuid="268fe625-e43f-48d5-90c7-f396d09cd88d">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
<property name="com.jaspersoft.studio.table.style.table_header" value="Table_TH"/>
<property name="com.jaspersoft.studio.table.style.column_header" value="Table_CH"/>
<property name="com.jaspersoft.studio.table.style.detail" value="Table_TD"/>
</reportElement>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="ReferencesDataset" uuid="67830a07-2594-4532-ae34-96829b8046da">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonQLDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("root.accounts.references.*")]]></dataSourceExpression>
</datasetRun>
<jr:column width="80" uuid="a8cf3aa0-1633-4f19-a908-6efbf55d2f75">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<staticText>
<reportElement x="0" y="0" width="80" height="30" uuid="b89609d4-5cbb-4f5b-b470-c9f9f4ad9d26"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[First Name]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField>
<reportElement x="0" y="0" width="80" height="30" uuid="ec954e2c-43e4-43ba-9005-03272b9daad5"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{firstName}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="80" uuid="e7f5cfca-a803-485d-be01-5d2f785fbf0b">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<staticText>
<reportElement x="0" y="0" width="80" height="30" uuid="0a2eb2ed-75b9-46c3-8751-871c5473c3e1"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Last Name]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField>
<reportElement x="0" y="0" width="80" height="30" uuid="767b9d15-53e5-4a0b-be8c-ec94fc6398f8"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{lastName}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="80" uuid="c7103510-df1d-4c31-a30f-9b726540dd7a">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column3"/>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<staticText>
<reportElement x="0" y="0" width="80" height="30" uuid="11192151-2c03-4590-91f7-87021b022301"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Bank]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField>
<reportElement x="0" y="0" width="80" height="30" uuid="97ec29f7-36f2-4ecc-9f30-3049e0648e97"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{bank}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="80" uuid="5a4bb23a-7d61-486b-91f8-b5150cb85817">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column4"/>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<staticText>
<reportElement x="0" y="0" width="80" height="30" uuid="30680d44-df3b-484e-b059-399e0a21b304"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Account Number]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField>
<reportElement x="0" y="0" width="80" height="30" uuid="ba6b13f3-770d-4a02-b3f0-5d4293393cd3"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{accountNumber}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="80" uuid="0720c554-a0af-4192-a669-38cea560a2e2">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column5"/>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<staticText>
<reportElement x="0" y="0" width="80" height="30" uuid="98adb234-9003-4704-85e4-295538f4273c"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Ref Name]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField>
<reportElement x="0" y="0" width="80" height="30" uuid="955502f3-afec-40aa-a8f8-b5e83d43bcbc"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="80" uuid="2aed257e-00f2-4594-a9ac-9b504262ee3e">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column6"/>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<staticText>
<reportElement x="0" y="0" width="80" height="30" uuid="be058bb0-b9f3-4b41-b074-c1f44350eb09"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Ref Account Number]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField>
<reportElement x="0" y="0" width="80" height="30" uuid="59563298-0f0f-4b62-b263-511abb945d1a"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{refAccountNumber}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</detail>
</jasperReport>
I have a page with two columns, which is a table of contents page, and I want to print bookmarks according to their level value on first and second column. The problem is although the printing order is set to vertical, when jasper finishes the first column it won't start from the beginning of the second column, but it writes at the end of the column.
As you can see on the picture, I need to have the sentence with yellow square at the beginning of the second column.
jrxml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.4.0.final using JasperReports Library version 6.4.1 -->
<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="Blank_A4_Landscape" columnCount="2" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="400" columnSpacing="2" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="b0cd6df7-ceab-4f93-aff6-668d7c75ce9b">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<parameter name="resourcePath" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA[""]]></defaultValueExpression>
</parameter>
<parameter name="Einrichtungspseudonym" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["Einrichtungspseudonym"]]></defaultValueExpression>
</parameter>
<parameter name="reportPart" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["reportPart"]]></defaultValueExpression>
</parameter>
<queryString language="SQL">
<![CDATA[]]>
</queryString>
<field name="level" class="java.lang.Integer"/>
<field name="label" class="java.lang.String"/>
<field name="pageIndex" class="java.lang.Integer"/>
<background>
<band splitType="Stretch"/>
</background>
<pageHeader>
<band height="50" splitType="Stretch">
<frame>
<reportElement x="0" y="0" width="702" height="50" backcolor="rgba(227, 218, 218, 0.46666667)" uuid="6ca5e261-9531-43ef-80ed-828dc6b4524f"/>
<rectangle>
<reportElement x="0" y="18" width="702" height="17" forecolor="#A1A1A1" backcolor="#D9D9D9" uuid="54beea72-4243-48ea-856e-29d9da8a0431">
<property name="com.jaspersoft.studio.unit.height" value="cm"/>
</reportElement>
<graphicElement>
<pen lineWidth="0.5" lineStyle="Solid"/>
</graphicElement>
</rectangle>
<textField isStretchWithOverflow="true">
<reportElement style="Kopfzeile" x="2" y="0" width="330" height="50" uuid="f9f8c8d7-253c-46bd-b8ab-fe737db7070d"/>
<textFieldExpression><![CDATA["Tabellen- und Abbildungsverzeichnis"]]></textFieldExpression>
<anchorNameExpression><![CDATA["Tabellen- und Abbildungsverzeichnis"]]></anchorNameExpression>
</textField>
<image>
<reportElement x="632" y="0" width="70" height="50" uuid="16558eec-b7b6-4fc4-b6ea-6fb3ff4b5e2f"/>
<imageExpression><![CDATA[$P{resourcePath}+"Logo_vertical_RGB.png"]]></imageExpression>
</image>
</frame>
</band>
</pageHeader>
<columnHeader>
<band height="20" splitType="Stretch">
<textField isStretchWithOverflow="true">
<reportElement style="Kapitelüberschrift" isPrintRepeatedValues="false" x="0" y="0" width="394" height="20" uuid="2d7b27c2-91b1-4d62-97b6-ca0d4dd1c099"/>
<textFieldExpression><![CDATA["Tabellen- und Abbildungsverzechnis"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement style="Kapitelüberschrift" isPrintRepeatedValues="false" x="412" y="0" width="388" height="20" uuid="edc812df-deaa-4511-9b46-1c5c963b31a9"/>
<textFieldExpression><![CDATA["Abbildungen der Ergebniszusammenfassung"]]></textFieldExpression>
</textField>
</band>
</columnHeader>
<detail>
<band height="113" splitType="Stretch">
<frame>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="411" y="3" width="340" height="17" isRemoveLineWhenBlank="true" uuid="517ee347-d843-43d4-9855-b4c1cc6b490c">
<printWhenExpression><![CDATA[$F{level} == 21]]></printWhenExpression>
</reportElement>
<rectangle>
<reportElement stretchType="ContainerHeight" x="0" y="0" width="11" height="17" isRemoveLineWhenBlank="true" forecolor="#E8A435" backcolor="#FCCF3A" uuid="3a9abeb8-b2a9-4650-b034-9eb7815e7f09">
<property name="com.jaspersoft.studio.unit.height" value="cm"/>
</reportElement>
<graphicElement>
<pen lineWidth="0.0" lineStyle="Solid"/>
</graphicElement>
</rectangle>
<textField isStretchWithOverflow="true" hyperlinkType="LocalAnchor">
<reportElement style="Standard" x="20" y="0" width="290" height="17" isRemoveLineWhenBlank="true" uuid="f96bf175-4d0f-494f-8eb6-ac9270a53ec5"/>
<textElement textAlignment="Left"/>
<textFieldExpression><![CDATA[$F{label}]]></textFieldExpression>
<hyperlinkAnchorExpression><![CDATA[$F{label}]]></hyperlinkAnchorExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement key="" style="Standard" x="310" y="0" width="30" height="17" isRemoveLineWhenBlank="true" uuid="eadc2beb-1873-44a7-b8ca-26815fc64601"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER} + $F{pageIndex} + 4]]></textFieldExpression>
</textField>
</frame>
<frame>
<reportElement isPrintRepeatedValues="false" x="0" y="3" width="351" height="110" isRemoveLineWhenBlank="true" uuid="f7f28f9f-f011-42c5-b10b-68986a90ce92">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
</reportElement>
<frame>
<reportElement positionType="Float" x="0" y="0" width="351" height="18" isRemoveLineWhenBlank="true" uuid="870d4b8e-dcf2-40dc-8c1a-4e77b878b898">
<printWhenExpression><![CDATA[$F{level} == 31]]></printWhenExpression>
</reportElement>
<textField isStretchWithOverflow="true" hyperlinkType="LocalAnchor">
<reportElement style="Standard_mit_html" mode="Transparent" x="20" y="0" width="301" height="18" isRemoveLineWhenBlank="true" uuid="6fee51d3-a833-48e2-8eba-72228aeb58d7">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
</reportElement>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Left" markup="styled"/>
<textFieldExpression><![CDATA[$F{label}]]></textFieldExpression>
<hyperlinkAnchorExpression><![CDATA[$F{label}]]></hyperlinkAnchorExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement style="Standard" x="321" y="0" width="30" height="18" isRemoveLineWhenBlank="true" uuid="5868d8c8-7eb1-495b-b848-a193237679a2">
<property name="com.jaspersoft.studio.unit.y" value="cm"/>
</reportElement>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[6]]></textFieldExpression>
</textField>
<rectangle>
<reportElement stretchType="ContainerHeight" x="0" y="0" width="11" height="18" isRemoveLineWhenBlank="true" forecolor="#5A49F2" backcolor="#783AFC" uuid="f52cbdd2-131c-4726-9945-dea36bb1275c">
<property name="com.jaspersoft.studio.unit.height" value="cm"/>
</reportElement>
<graphicElement>
<pen lineWidth="0.0" lineStyle="Solid"/>
</graphicElement>
</rectangle>
</frame>
<frame>
<reportElement positionType="Float" x="0" y="18" width="351" height="18" isRemoveLineWhenBlank="true" uuid="429e6789-ec18-4e23-b84a-ddff038ddf31">
<printWhenExpression><![CDATA[$F{level} == 32]]></printWhenExpression>
</reportElement>
<textField isStretchWithOverflow="true" hyperlinkType="LocalAnchor">
<reportElement style="Standard_mit_html" mode="Transparent" x="20" y="8" width="301" height="10" isRemoveLineWhenBlank="true" uuid="3e6b8d9c-94e8-47eb-b1ca-926607daf19e">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
</reportElement>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Left" markup="styled"/>
<textFieldExpression><![CDATA[$F{label}]]></textFieldExpression>
<hyperlinkAnchorExpression><![CDATA[$F{label}]]></hyperlinkAnchorExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement style="Standard" x="321" y="8" width="30" height="10" isRemoveLineWhenBlank="true" uuid="45cb3231-65b2-4b03-8387-cb67d968d4de">
<property name="com.jaspersoft.studio.unit.y" value="cm"/>
</reportElement>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[6]]></textFieldExpression>
</textField>
<rectangle>
<reportElement stretchType="ContainerHeight" x="0" y="8" width="11" height="10" isRemoveLineWhenBlank="true" forecolor="#1BAEF7" backcolor="#56B4FC" uuid="8f7cd5e1-539e-455d-992d-7754d5b50aef">
<property name="com.jaspersoft.studio.unit.height" value="cm"/>
</reportElement>
<graphicElement>
<pen lineWidth="0.0" lineStyle="Solid"/>
</graphicElement>
</rectangle>
</frame>
</frame>
</band>
</detail>
<pageFooter>
<band height="31" splitType="Stretch">
<frame>
<reportElement x="0" y="0" width="802" height="31" uuid="99847b36-f679-406b-b7c6-44151acc24e4">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/>
</reportElement>
<textField isStretchWithOverflow="true">
<reportElement style="Fußzeile 8,5pt" x="0" y="0" width="394" height="31" uuid="5d388cd5-181d-48b6-981a-9034f2ca3edf"/>
<textElement verticalAlignment="Bottom"/>
<textFieldExpression><![CDATA["© report: Quartalsbericht "+$P{reportPart}+" für Einrichtung "+$P{Einrichtungspseudonym}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" evaluationTime="Master">
<reportElement style="Fußzeile 8,5pt" x="408" y="0" width="394" height="31" uuid="4efe47cc-4b4c-415a-9c38-1cfabd3c347d">
<property name="com.jaspersoft.studio.unit.x" value="cm"/>
</reportElement>
<textElement textAlignment="Right" verticalAlignment="Bottom"/>
<textFieldExpression><![CDATA[$V{MASTER_CURRENT_PAGE} != null ? $V{MASTER_CURRENT_PAGE}+"/"+$V{MASTER_TOTAL_PAGES} : $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</frame>
</band>
</pageFooter>
I tried another approach as well, in which I just created a page with single column, then put the fields in two frames, one on the left side and the other one on the write side of the page. But the result is just same as previous approach.
Code for the single column page:
<?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="Abbildungsverzeichnis" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="702" leftMargin="70" rightMargin="70" topMargin="42" bottomMargin="42" whenResourceMissingType="Empty" uuid="6e74177b-d551-4a75-ae51-6cdde3f284ce">
<property name="com.jaspersoft.studio.unit." value="cm"/>
<property name="net.sf.jasperreports.print.create.bookmarks" value="false"/>
<template><![CDATA[$P{resourcePath}+"styles.jrtx"]]></template>
<parameter name="resourcePath" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA[""]]></defaultValueExpression>
</parameter>
<parameter name="Einrichtungspseudonym" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["Einrichtungspseudonym"]]></defaultValueExpression>
</parameter>
<parameter name="Berichtsquartal" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["Berichtsquartal"]]></defaultValueExpression>
</parameter>
<queryString language="XPath">
<![CDATA[/QSDialyse2018QuartalsberichtLe]]>
</queryString>
<field name="level" class="java.lang.Integer"/>
<field name="label" class="java.lang.String"/>
<field name="pageIndex" class="java.lang.Integer"/>
<background>
<band splitType="Stretch"/>
</background>
<pageHeader>
<band height="50">
<frame>
<reportElement x="0" y="0" width="702" height="50" backcolor="rgba(227, 218, 218, 0.46666667)" uuid="06038290-751d-4458-807d-96a3e51e7d1d"/>
<rectangle>
<reportElement x="0" y="18" width="702" height="17" forecolor="#A1A1A1" backcolor="#D9D9D9" uuid="ca066fcc-d491-4f4b-aa09-17ae01773098">
<property name="com.jaspersoft.studio.unit.height" value="cm"/>
</reportElement>
<graphicElement>
<pen lineWidth="0.5" lineStyle="Solid"/>
</graphicElement>
</rectangle>
<textField isStretchWithOverflow="true">
<reportElement style="Kopfzeile" x="2" y="0" width="330" height="50" uuid="4a0983f4-b41e-4828-a73d-7e285cb31887"/>
<textFieldExpression><![CDATA["Tabellen- und Abbildungsverzeichnis"]]></textFieldExpression>
<anchorNameExpression><![CDATA["Tabellen- und Abbildungsverzeichnis"]]></anchorNameExpression>
</textField>
</frame>
</band>
</pageHeader>
<detail>
<band height="110" splitType="Stretch">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
<frame>
<reportElement isPrintRepeatedValues="false" x="0" y="0" width="351" height="110" isRemoveLineWhenBlank="true" uuid="c5f75321-dadb-4152-acab-6208ed6878de">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
</reportElement>
<frame>
<reportElement positionType="Float" isPrintRepeatedValues="false" x="0" y="0" width="351" height="18" isRemoveLineWhenBlank="true" uuid="a3604c51-5a78-4577-b0f8-2cc19c403996">
<printWhenExpression><![CDATA[$F{level} == 31]]></printWhenExpression>
</reportElement>
<textField isStretchWithOverflow="true" hyperlinkType="LocalAnchor">
<reportElement style="Standard_mit_html" isPrintRepeatedValues="false" mode="Transparent" x="20" y="0" width="301" height="18" isRemoveLineWhenBlank="true" uuid="379fcff2-021d-4761-a89a-eeb772723b1b">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
</reportElement>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Left" markup="styled"/>
<textFieldExpression><![CDATA[$F{label}]]></textFieldExpression>
<hyperlinkAnchorExpression><![CDATA[$F{label}]]></hyperlinkAnchorExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement style="Standard" x="321" y="0" width="30" height="18" isRemoveLineWhenBlank="true" uuid="207a4316-1f91-4886-91f9-9a86c788a83f">
<property name="com.jaspersoft.studio.unit.y" value="cm"/>
</reportElement>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER} + $F{pageIndex} + 4]]></textFieldExpression>
</textField>
<rectangle>
<reportElement stretchType="ContainerHeight" x="0" y="0" width="11" height="18" isRemoveLineWhenBlank="true" forecolor="#5A49F2" backcolor="#783AFC" uuid="f9a97c9f-4bc7-4ede-b082-d39a697f10ec">
<property name="com.jaspersoft.studio.unit.height" value="cm"/>
</reportElement>
<graphicElement>
<pen lineWidth="0.0" lineStyle="Solid"/>
</graphicElement>
</rectangle>
</frame>
<frame>
<reportElement positionType="Float" isPrintRepeatedValues="false" x="0" y="18" width="351" height="18" isRemoveLineWhenBlank="true" uuid="c01291d6-8266-4368-bd93-8a9dc0b52770">
<printWhenExpression><![CDATA[$F{level} == 32]]></printWhenExpression>
</reportElement>
<textField isStretchWithOverflow="true" hyperlinkType="LocalAnchor">
<reportElement style="Standard_mit_html" isPrintRepeatedValues="false" mode="Transparent" x="20" y="8" width="301" height="10" isRemoveLineWhenBlank="true" uuid="8213d17a-5e7d-4fd2-81b2-509045752b80">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
</reportElement>
<textElement textAlignment="Left" markup="styled"/>
<textFieldExpression><![CDATA[$F{label}]]></textFieldExpression>
<hyperlinkAnchorExpression><![CDATA[$F{label}]]></hyperlinkAnchorExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement style="Standard" x="321" y="8" width="30" height="10" isRemoveLineWhenBlank="true" uuid="1ced4974-5ea1-4ef1-86cb-dfd3fa5bd736">
<property name="com.jaspersoft.studio.unit.y" value="cm"/>
</reportElement>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER} + $F{pageIndex} + 4]]></textFieldExpression>
</textField>
<rectangle>
<reportElement stretchType="ContainerHeight" x="0" y="8" width="11" height="10" isRemoveLineWhenBlank="true" forecolor="#1BAEF7" backcolor="#56B4FC" uuid="ee55c1ea-8c69-45ae-86d8-6166dcddb18b">
<property name="com.jaspersoft.studio.unit.height" value="cm"/>
</reportElement>
<graphicElement>
<pen lineWidth="0.0" lineStyle="Solid"/>
</graphicElement>
</rectangle>
</frame>
</frame>
<frame>
<reportElement isPrintRepeatedValues="false" x="362" y="0" width="340" height="17" isRemoveLineWhenBlank="true" uuid="d1247e47-59b4-4930-ad78-c76a0374f555">
<property name="ShowOutOfBoundContent" value="false"/>
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
<printWhenExpression><![CDATA[$F{level} == 21]]></printWhenExpression>
</reportElement>
<rectangle>
<reportElement stretchType="ContainerHeight" x="5" y="0" width="11" height="17" isRemoveLineWhenBlank="true" forecolor="#E8A435" backcolor="#FCCF3A" uuid="38bc71e5-6d69-4ab3-8a6b-0c1bba53a26c">
<property name="com.jaspersoft.studio.unit.height" value="cm"/>
</reportElement>
<graphicElement>
<pen lineWidth="0.0" lineStyle="Solid"/>
</graphicElement>
</rectangle>
<textField isStretchWithOverflow="true" hyperlinkType="LocalAnchor">
<reportElement style="Standard" x="20" y="0" width="290" height="17" isRemoveLineWhenBlank="true" uuid="b19a02f7-3d3f-4086-86ed-5dc6859e5fd1"/>
<textElement textAlignment="Left"/>
<textFieldExpression><![CDATA[$F{label}]]></textFieldExpression>
<hyperlinkAnchorExpression><![CDATA[$F{label}]]></hyperlinkAnchorExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement key="" style="Standard" x="310" y="0" width="30" height="17" isRemoveLineWhenBlank="true" uuid="bc43bd36-7466-457c-95e6-384410c05cbe"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER} + $F{pageIndex} + 4]]></textFieldExpression>
</textField>
</frame>
</band>
</detail>
<pageFooter>
<band height="31">
<frame>
<reportElement x="0" y="0" width="702" height="31" uuid="ca4af90c-cc2f-406c-865f-59680b968139">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/>
</reportElement>
<textField isStretchWithOverflow="true">
<reportElement style="Fußzeile 8,5pt" x="0" y="0" width="351" height="31" uuid="c3e365c7-5dde-419e-a0da-950bf7d16710"/>
<textElement verticalAlignment="Bottom"/>
<textFieldExpression><![CDATA["© report: Quartalsbericht "+$P{Berichtsquartal}+" für Einrichtung "+$P{Einrichtungspseudonym}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" evaluationTime="Master">
<reportElement style="Fußzeile 8,5pt" x="351" y="0" width="351" height="31" uuid="94da8446-69d3-4dc9-a791-d413082e42cc">
<property name="com.jaspersoft.studio.unit.x" value="cm"/>
</reportElement>
<textElement textAlignment="Right" verticalAlignment="Bottom"/>
<textFieldExpression><![CDATA[$V{MASTER_CURRENT_PAGE} != null ? $V{MASTER_CURRENT_PAGE}+"/"+$V{MASTER_TOTAL_PAGES} : $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</frame>
</band>
</pageFooter>
Related to your first attempt, you have misunderstood how multiple columns page work.
You do not decided in which column the fields will go, by positioning them accordingly, instead jasper-report will break to next column based on printOrder, if vertical it will break when it hits end of page or finds a manual column break either through a group or a
<break type="Column">
<reportElement x="0" y="15" width="100" height="1" uuid="c082e856-5507-4b0f-9dde-01b7fac85a4f"/>
</break>
Using multiple columns with manual column break
This solution is feasible if you are sure that first part will fit in first column on the page, if it does not it will overflow in second column and the column break will lead to a page break,
The solution is to sort data and then either group as in example below or by adding a manual column break as above.
Example (using datasource from this question), break to new column when reputation is less then 100.000
<?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="2columnsbreak" columnCount="2" pageWidth="595" pageHeight="842" columnWidth="277" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="81a13ec8-f22d-44f0-9335-c15e2fe28614">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="CVS"/>
<queryString language="csv">
<![CDATA[]]>
</queryString>
<field name="User" class="java.lang.String"/>
<field name="Rep" class="java.lang.Integer"/>
<group name="UserWithLowRep" isStartNewColumn="true">
<groupExpression><![CDATA[($F{Rep}<100000)]]></groupExpression>
</group>
<columnHeader>
<band height="24" splitType="Stretch">
<textField evaluationTime="Group" evaluationGroup="UserWithLowRep">
<reportElement x="0" y="0" width="270" height="20" uuid="456c89e2-8e48-4e01-95ff-e56f2b150e0f"/>
<textFieldExpression><![CDATA[($V{COLUMN_NUMBER}==1?"User with high rep":"User with low rep")]]></textFieldExpression>
</textField>
</band>
</columnHeader>
<detail>
<band height="23" splitType="Stretch">
<textField>
<reportElement x="0" y="0" width="270" height="20" uuid="2daf5f8f-87a1-4f7e-b1de-2807811a1ddd"/>
<textFieldExpression><![CDATA[$F{User}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
The groupExpression will break to new column when it changes
Output
Note How you can use the built-in variabile $V{COLUMN_NUMBER}, to output and format data as you like depending on column. In this example 2 columns it will either have value 1 (for data in first column) or 2 (for data in second column).
I have a simple Spring-based web application for reporting about measurement tools. I'm using the following JRXML pattern (generated by TIBCO Jaspersoft Studio), let's say report_3.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="Blank_A4" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<style name="Default" isDefault="true" pdfFontName="ARIAL.TTF" pdfEncoding="Cp1251"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="polviz" class="java.lang.String"/>
<field name="polzex" class="java.lang.String"/>
<field name="polnaim" class="java.lang.String"/>
<field name="tip" class="java.lang.String"/>
<field name="klt" class="java.lang.Double"/>
<field name="pred" class="java.lang.String"/>
<field name="zavn" class="java.lang.String"/>
<field name="npasp" class="java.lang.Integer"/>
<field name="pp" class="java.lang.Integer"/>
<field name="n" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="84">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<staticText>
<reportElement x="410" y="0" width="100" height="20" isPrintWhenDetailOverflows="true"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[УТВЕРЖДАЮ]]></text>
</staticText>
<staticText>
<reportElement x="410" y="14" width="100" height="20" />
<text><![CDATA[Главный метролог]]></text>
</staticText>
<line>
<reportElement x="410" y="39" width="120" height="1" />
</line>
<staticText>
<reportElement x="410" y="39" width="140" height="30" />
<textElement>
<font size="6"/>
</textElement>
<text><![CDATA[(подпись, расшифровка подписи, дата)]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="85" splitType="Stretch">
<staticText>
<reportElement positionType="FixRelativeToBottom" x="-2" y="0" width="559" height="20" />
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman"/>
</textElement>
<text><![CDATA[Общая ведомость средств измерений по цехам]]></text>
</staticText>
<line>
<reportElement x="0" y="83" width="554" height="1" >
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
</line>
<textField>
<reportElement stretchType="RelativeToTallestObject" x="0" y="66" width="554" height="16" />
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{polviz}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="1" y="52" width="552" height="14" />
<textElement textAlignment="Right" verticalAlignment="Middle">
<font isItalic="false"/>
</textElement>
<text><![CDATA[/ N - не проверено, R - ремонт, К - консервация /]]></text>
</staticText>
<textField>
<reportElement stretchType="RelativeToTallestObject" x="1" y="30" width="552" height="20" />
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{polzex}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<columnHeader>
<band height="34" splitType="Stretch">
<staticText>
<reportElement x="1" y="1" width="110" height="30" />
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Наим. средства изм.]]></text>
</staticText>
<staticText>
<reportElement x="110" y="1" width="50" height="30" />
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Тип]]></text>
</staticText>
<staticText>
<reportElement x="160" y="1" width="68" height="30" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Предел изм.]]></text>
</staticText>
<staticText>
<reportElement x="280" y="1" width="78" height="30" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Зав. ном.]]></text>
</staticText>
<line>
<reportElement x="0" y="32" width="554" height="1" />
</line>
<line>
<reportElement x="0" y="-2" width="1" height="34" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
</line>
<line>
<reportElement x="109" y="-2" width="1" height="34" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
</line>
<line>
<reportElement x="159" y="-2" width="1" height="34" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
</line>
<line>
<reportElement x="228" y="-2" width="1" height="34" />
</line>
<line>
<reportElement x="359" y="-2" width="1" height="34" />
</line>
<staticText>
<reportElement x="360" y="1" width="74" height="30" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Ном. пасп.]]></text>
</staticText>
<line>
<reportElement x="434" y="-2" width="1" height="34" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
</line>
<staticText>
<reportElement x="436" y="0" width="54" height="30" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Периодич.]]></text>
</staticText>
<line>
<reportElement x="490" y="-2" width="1" height="34" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
</line>
<staticText>
<reportElement x="490" y="0" width="62" height="30" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Неп,Рем,Конс]]></text>
</staticText>
<line>
<reportElement x="554" y="-1" width="1" height="33" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
</line>
<staticText>
<reportElement x="230" y="1" width="46" height="30" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Кл.т.]]></text>
</staticText>
<line>
<reportElement x="277" y="-2" width="1" height="34" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
</line>
</band>
</columnHeader>
<detail>
<band height="33">
<line>
<reportElement x="1" y="19" width="553" height="1" forecolor="#E5E5E5" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
</line>
<textField>
<reportElement x="2" y="1" width="108" height="18" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{polnaim}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="111" y="1" width="50" height="18" >
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{tip}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="161" y="1" width="68" height="18" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{pred}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="230" y="1" width="48" height="18" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{klt}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="278" y="1" width="82" height="18" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{zavn}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="360" y="1" width="76" height="18" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{npasp}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="436" y="1" width="56" height="18" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{pp}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="492" y="1" width="62" height="18" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{n}]]></textFieldExpression>
</textField>
</band>
</detail>
<lastPageFooter>
<band height="21"/>
</lastPageFooter>
</jasperReport>
Part of JasperReportsController controller:
...
#Controller
#RequestMapping("/jasper-reports/")
public class JasperReportsController {
#Autowired(required = true)
private MetrologServices metrologServices;
#Autowired
private ApplicationContext appContext;
#RequestMapping(method = RequestMethod.GET, value = "report_3")
public ModelAndView generateThirdPdfReport(ModelAndView modelAndView) {
JasperReportsPdfView jrPdfView = new JasperReportsPdfView();
List<ReportDTO> records = findInventoryReportData();
Map<String, Object> map = new HashMap<String, Object>();
map.put("records", records);
jrPdfView.setUrl("classpath:report_3.jrxml");
jrPdfView.setReportDataKey("records");
jrPdfView.setApplicationContext(appContext);
modelAndView = new ModelAndView(jrPdfView, map);
return modelAndView;
}
private List<ReportDTO> findInventoryReportData() {
List<ReportDTO> result = metrologServices.loadInventoryData();
return result;
}
...
}
Somewhere in the view I call the controller:
$("#btn-print").attr("href", "${home}/metrolog/jasper-reports/report_3");
As a result I get the following report:
I want to start the list of measurement tools for each department with a new page. For example, part of the measuring tools belongs to department 1, another part belongs to department 2, etc.
I'd advise the following documentation: Chapter 14. View technologies, see section "14.7.4. Working with Sub-Reports":
JasperReports provides support for embedded sub-reports within your
master report files. There are a wide variety of mechanisms for
including sub-reports in your report files. The easiest way is to hard
code the report path and the SQL query for the sub report into your
design files. The drawback of this approach is obvious - the values
are hard-coded into your report files reducing reusability and making
it harder to modify and update report designs. To overcome this you
can configure sub-reports declaratively and you can include additional
data for these sub-reports directly from your controllers.
To control which sub-report files are included in a master report
using Spring, your report file must be configured to accept
sub-reports from an external source. To do this you declare a
parameter in your report file like so:
<parameter name="ProductsSubReport" class="net.sf.jasperreports.engine.JasperReport"/>
Then, you define your sub-report to use this sub-report parameter:
<subreport>
<reportElement isPrintRepeatedValues="false" x="5" y="25" width="325"
height="20" isRemoveLineWhenBlank="true" backcolor="#ffcc99"/>
<subreportParameter name="City">
<subreportParameterExpression><![CDATA[$F{city}]]></subreportParameterExpression>
</subreportParameter>
<dataSourceExpression><![CDATA[$P{SubReportData}]]></dataSourceExpression>
<subreportExpression class="net.sf.jasperreports.engine.JasperReport">
<![CDATA[$P{ProductsSubReport}]]></subreportExpression>
</subreport>
This defines a master report file that expects the sub-report to be
passed in as an instance of
net.sf.jasperreports.engine.JasperReports under the parameter
ProductsSubReport. When configuring your Jasper view class, you can
instruct Spring to load a report file and pass into the JasperReports
engine as a sub-report using the subReportUrls property:
<property name="subReportUrls">
<map>
<entry key="ProductsSubReport" value="/WEB-INF/reports/subReportChild.jrxml"/>
</map>
</property>
Here, the key of the Map corresponds to the name of the sub-report
parameter in th report design file, and the entry is the URL of the
report file. Spring will load this report file, compiling it if
necessary, and will pass into the JasperReports engine under the given
key.
Hence, the master report file can be represented as follows:
report_3.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="Blank_A4" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<style name="Default" isDefault="true" pdfFontName="ARIAL.TTF" pdfEncoding="Cp1251"/>
<parameter name="Kpp9SubReport" class="net.sf.jasperreports.engine.JasperReport"/>
<parameter name="Kpp9SubReportData" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/>
<parameter name="..." class="net.sf.jasperreports.engine.JasperReport"/>
<parameter name="..." class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/>
...
etc
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="84">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<staticText>
<reportElement x="410" y="0" width="100" height="20" isPrintWhenDetailOverflows="true"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[УТВЕРЖДАЮ]]></text>
</staticText>
<staticText>
<reportElement x="410" y="14" width="100" height="20" />
<text><![CDATA[Главный метролог]]></text>
</staticText>
<line>
<reportElement x="410" y="39" width="120" height="1" />
</line>
<staticText>
<reportElement x="410" y="39" width="140" height="30" />
<textElement>
<font size="6"/>
</textElement>
<text><![CDATA[(подпись, расшифровка подписи, дата)]]></text>
</staticText>
</band>
</title>
<detail>
<band height="500">
<subreport>
<reportElement isPrintRepeatedValues="false" x="-10" y="0" width="325" height="1" isRemoveLineWhenBlank="false" backcolor="#ffcc99"/>
<dataSourceExpression><![CDATA[$P{DepartmentKpp9SubReportData}]]></dataSourceExpression>
<subreportExpression class="net.sf.jasperreports.engine.JasperReport">
<![CDATA[$P{DepartmentKpp9SubReport}]]></subreportExpression>
</subreport>
<break type="Page">
<reportElement x="-10" y="1" width="325" height="10" key="element-1"/>
</break>
</band>
<band height="500">
<subreport>
<reportElement isPrintRepeatedValues="false" x="-10" y="2" width="325" height="1" isRemoveLineWhenBlank="false" backcolor="#ffcc99"/>
<dataSourceExpression><![CDATA[$P{Department8SubReportData}]]></dataSourceExpression>
<subreportExpression class="net.sf.jasperreports.engine.JasperReport">
<![CDATA[$P{Department8SubReport}]]></subreportExpression>
</subreport>
<break type="Page">
<reportElement x="-10" y="3" width="325" height="1" key="element-2"/>
</break>
</band>
<band height="500">
...
</band>
...
etc
</detail>
<lastPageFooter>
<band height="21"/>
</lastPageFooter>
</jasperReport>
The sub-report report_4.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="Blank_A4" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<style name="Default" isDefault="true" pdfFontName="ARIAL.TTF" pdfEncoding="Cp1251"/>
<field name="polviz" class="java.lang.String"/>
<field name="polzex" class="java.lang.String"/>
<field name="polnaim" class="java.lang.String"/>
<field name="tip" class="java.lang.String"/>
<field name="klt" class="java.lang.Double"/>
<field name="pred" class="java.lang.String"/>
<field name="zavn" class="java.lang.String"/>
<field name="npasp" class="java.lang.Integer"/>
<field name="pp" class="java.lang.Integer"/>
<field name="n" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<pageHeader>
<band height="85" splitType="Stretch">
<staticText>
<reportElement positionType="FixRelativeToBottom" x="-2" y="0" width="559" height="20" />
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman"/>
</textElement>
<text><![CDATA[Общая ведомость средств измерений по цехам]]></text>
</staticText>
<line>
<reportElement x="0" y="83" width="554" height="1" >
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
</line>
<textField>
<reportElement stretchType="RelativeToTallestObject" x="0" y="66" width="554" height="16" />
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{polviz}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="1" y="52" width="552" height="14" />
<textElement textAlignment="Right" verticalAlignment="Middle">
<font isItalic="false"/>
</textElement>
<text><![CDATA[/ N - не проверено, R - ремонт, К - консервация /]]></text>
</staticText>
<textField>
<reportElement stretchType="RelativeToTallestObject" x="1" y="30" width="552" height="20" />
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{polzex}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<columnHeader>
<band height="34" splitType="Stretch">
<staticText>
<reportElement x="1" y="1" width="110" height="30" />
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Наим. средства изм.]]></text>
</staticText>
<staticText>
<reportElement x="110" y="1" width="50" height="30" />
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Тип]]></text>
</staticText>
<staticText>
<reportElement x="160" y="1" width="68" height="30" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Предел изм.]]></text>
</staticText>
<staticText>
<reportElement x="280" y="1" width="78" height="30" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Зав. ном.]]></text>
</staticText>
<line>
<reportElement x="0" y="32" width="554" height="1" />
</line>
<line>
<reportElement x="0" y="-2" width="1" height="34" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
</line>
<line>
<reportElement x="109" y="-2" width="1" height="34" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
</line>
<line>
<reportElement x="159" y="-2" width="1" height="34" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
</line>
<line>
<reportElement x="228" y="-2" width="1" height="34" />
</line>
<line>
<reportElement x="359" y="-2" width="1" height="34" />
</line>
<staticText>
<reportElement x="360" y="1" width="74" height="30" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Ном. пасп.]]></text>
</staticText>
<line>
<reportElement x="434" y="-2" width="1" height="34" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
</line>
<staticText>
<reportElement x="436" y="0" width="54" height="30" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Периодич.]]></text>
</staticText>
<line>
<reportElement x="490" y="-2" width="1" height="34" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
</line>
<staticText>
<reportElement x="490" y="0" width="62" height="30" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Неп,Рем,Конс]]></text>
</staticText>
<line>
<reportElement x="554" y="-1" width="1" height="33" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
</line>
<staticText>
<reportElement x="230" y="1" width="46" height="30" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Кл.т.]]></text>
</staticText>
<line>
<reportElement x="277" y="-2" width="1" height="34" >
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
</line>
</band>
</columnHeader>
<detail>
<band height="33">
<line>
<reportElement x="1" y="19" width="553" height="1" forecolor="#E5E5E5" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
</line>
<textField>
<reportElement x="2" y="1" width="108" height="18" />
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{polnaim}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="111" y="1" width="50" height="18" >
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{tip}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="161" y="1" width="68" height="18" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{pred}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="230" y="1" width="48" height="18" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{klt}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="278" y="1" width="82" height="18" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{zavn}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="360" y="1" width="76" height="18" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{npasp}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="436" y="1" width="56" height="18" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{pp}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="492" y="1" width="62" height="18" >
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{n}]]></textFieldExpression>
</textField>
</band>
</detail>
<lastPageFooter>
<band height="21"/>
</lastPageFooter>
</jasperReport>
Part of JasperReportsController controller(we consider only the case of one department, the other sub-reports can be obtained similarly using the same templates report_3.jrxml and report_4.jrxml):
...
#Controller
#RequestMapping("/jasper-reports/")
public class JasperReportsController {
#Autowired(required = true)
private MetrologServices metrologServices;
#Autowired
private ApplicationContext appContext;
#RequestMapping(method = RequestMethod.GET, value="report_3")
public ModelAndView generateThirdPdfReport(ModelAndView modelAndView) {
JasperReportsPdfView jrPdfView = new JasperReportsPdfView();
List<ReportDTO> records = findInventoryReportData();
Map<String, Object> map = new HashMap<>();
map.put("records", records);
Properties subReports = new Properties();
subReports.put("Kpp9SubReport", "classpath:report_4.jrxml");
List<ReportDTO> kpp9SubReportRecords = new ArrayList<>();
records.forEach(record -> {
if(record.getPolzex().equalsIgnoreCase("КПП 9")) {
kpp9SubReportRecords.add(record);
}
});
JRDataSource kpp9SubReportDataSource =
new JRBeanCollectionDataSource(kpp9SubReportRecords);
parameterMap.put("Kpp9SubReportData", kpp9SubReportDataSource);
jrPdfView.setSubReportUrls(subReports);
jrPdfView.setSubReportDataKeys("Kpp9SubReportData");
jrPdfView.setUrl("classpath:report_3.jrxml");
jrPdfView.setReportDataKey("records");
jrPdfView.setApplicationContext(appContext);
modelAndView = new ModelAndView(jrPdfView, map);
return modelAndView;
}
private List<ReportDTO> findInventoryReportData() {
List<ReportDTO> result = metrologServices.loadInventoryData();
return result;
}
...
}
As a result, we getting such a report, as required(in the department there are only five measuring instruments):
What do these error messages (in red FitCol, FitRow) mean when developing a table in Jasper Studio?
On error tab doesn't show any message.
How can I fix them?
This is the JRXML CODE:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.1.1.final using JasperReports Library version 6.1.1 -->
<!-- 2016-08-25T12:40:39 -->
<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="1808" pageWidth="2800" pageHeight="595" orientation="Landscape" columnWidth="2760" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isIgnorePagination="true" uuid="83010943-1966-4851-8b4c-aad3d0517ed9">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<style name="Table_TH" mode="Opaque" backcolor="#F0F8FF" pattern="" isBold="true">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table_CH" mode="Opaque" backcolor="#17375D">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="Dataset1" uuid="b1d60b48-df80-41d7-8eaa-0cc49107e428">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="SQLSRV_SQLDEV"/>
<parameter name="CODPEDIDO" class="java.lang.Integer">
<defaultValueExpression><![CDATA[90918]]></defaultValueExpression>
</parameter>
<queryString language="SQL">
<![CDATA[EXEC dbo.pr_sql_server_procedure #CodPedido = $P{CODPEDIDO}]]>
</queryString>
<field name="data_resp" class="java.sql.Timestamp"/>
<field name="NOME_CAND" class="java.lang.String"/>
<field name="DTNASC_CAND" class="java.lang.String"/>
<field name="IDADE_CAND" class="java.lang.Integer"/>
<field name="CIDADE_CAND" class="java.lang.String"/>
<field name="EMAIL_CAND" class="java.lang.String"/>
<field name="CEL_CAND" class="java.lang.String"/>
<field name="UltCargo_exp" class="java.lang.String"/>
<field name="nivel_de_formacao_academica_Desc" class="java.lang.String"/>
<field name="formacao_academica_Desc" class="java.lang.String"/>
<field name="tem_experiencia_como_docente_Desc" class="java.lang.String"/>
<field name="tempo_de_experiencia_profissional_Desc" class="java.lang.String"/>
<field name="segmento_experiencia_como_docente_Desc" class="java.lang.String"/>
<field name="nivel_de_experiencia_como_docente_Desc" class="java.lang.String"/>
<field name="estadocidade_de_atuacao_Desc" class="java.lang.String"/>
<field name="cursos_que_pode_ministrar_aulas_Desc" class="java.lang.String"/>
<field name="publicacoes__possui_Desc" class="java.lang.String"/>
<field name="publicacoes__quantas_Desc" class="java.lang.String"/>
<field name="link_para_o_curriculo_lattes" class="java.lang.String"/>
</subDataset>
<parameter name="PATH" class="java.lang.String" isForPrompting="false">
<parameterDescription><![CDATA[]]></parameterDescription>
<defaultValueExpression><![CDATA["/home/diego.queres/Desenv/Relatórios Clientes/1808"]]></defaultValueExpression>
</parameter>
<parameter name="CODPEDIDO" class="java.lang.Integer">
<parameterDescription><![CDATA[Código do pedido do relatório]]></parameterDescription>
<defaultValueExpression><![CDATA[90953]]></defaultValueExpression>
</parameter>
<queryString language="plsql">
<![CDATA[SELECT 1 AS [GERAR]]]>
</queryString>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="81">
<image scaleImage="RetainShape">
<reportElement x="0" y="0" width="140" height="81" uuid="b1c8d3f8-1aa1-4d3c-b23c-7933cc5bd368"/>
<imageExpression><![CDATA[$P{PATH} + "/Logo.jpg"]]></imageExpression>
</image>
<staticText>
<reportElement x="212" y="25" width="401" height="30" uuid="36c73e3e-05ee-4f60-b67f-7906c3054369"/>
<textElement verticalAlignment="Middle">
<font size="14" isBold="true"/>
</textElement>
<text><![CDATA[REPORT TITLE]]></text>
</staticText>
</band>
</title>
<summary>
<band height="90" splitType="Prevent">
<componentElement>
<reportElement x="0" y="0" width="2760" height="90" uuid="758f6154-5ad1-4973-a17d-c4aa560f766c">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
</reportElement>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="Dataset1" uuid="e746e840-22f7-455b-8c48-d328fffe6f3c">
<datasetParameter name="CODPEDIDO">
<datasetParameterExpression><![CDATA[$P{CODPEDIDO}]]></datasetParameterExpression>
</datasetParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
<jr:column width="100" uuid="f113ee3f-28c0-4eca-b7c0-3576439bd602">
<jr:columnHeader style="Table_CH" height="60">
<staticText>
<reportElement x="0" y="0" width="100" height="60" forecolor="#FFFFFF" uuid="3859baa0-fac3-4435-b557-ed6e8d3be9b2"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Data preenchimento da Ficha]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="100" height="30" uuid="6b6a4d0c-563f-4bff-ac63-4922afc9e7e4">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/>
</reportElement>
<textFieldExpression><![CDATA[$F{data_resp}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="100" uuid="99644605-94f5-4c09-a115-c478eba1a722">
<jr:columnHeader style="Table_CH" height="60">
<staticText>
<reportElement x="0" y="0" width="100" height="60" forecolor="#FFFFFF" uuid="54ff5aca-26cc-4dad-ab84-46b36944e12a"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Nome]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="100" height="30" uuid="7026cec4-42b1-4be7-b022-cbde3a7eedb0">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/>
</reportElement>
<textFieldExpression><![CDATA[$F{NOME_CAND}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="100" uuid="0a03b7a5-b49c-4760-a6f1-b12d6bbc646d">
<jr:columnHeader style="Table_CH" height="60">
<staticText>
<reportElement x="0" y="0" width="100" height="60" forecolor="#FFFFFF" uuid="8d792597-81e8-4f9a-a758-b352ba654e79"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Data Nascimento]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="100" height="30" uuid="e3e14b32-5893-4acb-bfe8-73bd782ae5fb">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/>
</reportElement>
<textFieldExpression><![CDATA[$F{DTNASC_CAND}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="100" uuid="6c6a4505-2ee3-436f-9071-74bcf7e42820">
<jr:columnHeader style="Table_CH" height="60">
<staticText>
<reportElement x="0" y="0" width="100" height="60" forecolor="#FFFFFF" uuid="8f1d7fd5-3b7f-48b6-b967-d9be5752dbc3">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Idade]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="100" height="30" uuid="35222a3b-fe46-47f8-8cdf-9ad0907cd68b">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/>
</reportElement>
<textFieldExpression><![CDATA[$F{IDADE_CAND}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="100" uuid="b85a3099-2c1f-4b57-bc98-00d53780e25a">
<jr:columnHeader style="Table_CH" height="60">
<staticText>
<reportElement x="0" y="0" width="100" height="60" forecolor="#FFFFFF" uuid="991f79a0-31d5-47a3-b943-760cd4e0d186"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Cidade]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="100" height="30" uuid="4db67ac3-270a-4ad5-aaa9-d460ffc1c332">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/>
</reportElement>
<textFieldExpression><![CDATA[$F{CIDADE_CAND}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="100" uuid="4207331a-d3d5-454d-ae58-e84f442c9c4a">
<jr:columnHeader style="Table_CH" height="60">
<staticText>
<reportElement x="0" y="0" width="100" height="60" forecolor="#FFFFFF" uuid="0b4792b6-b364-41f9-a889-55f97da64324"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[E-mail]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="100" height="30" uuid="c1f57528-8425-491e-b9b6-b0354d80de9f">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/>
</reportElement>
<textFieldExpression><![CDATA[$F{EMAIL_CAND}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="100" uuid="7a32b248-2fe0-41ec-aa4a-767119c61f7e">
<jr:columnHeader style="Table_CH" height="60">
<staticText>
<reportElement x="0" y="0" width="100" height="60" forecolor="#FFFFFF" uuid="3a1e253b-a860-4568-86a8-7077c1533a65"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Telefone Celular]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="100" height="30" uuid="4251eda8-07c2-44c5-a9f6-dc6d3b84b0c6">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/>
</reportElement>
<textFieldExpression><![CDATA[$F{CEL_CAND}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="100" uuid="039b7e62-a65e-425c-aeb8-b37f91a9749f">
<jr:columnHeader style="Table_CH" height="60">
<staticText>
<reportElement x="0" y="0" width="100" height="60" forecolor="#FFFFFF" uuid="fb57b137-a5a4-4d47-be6c-f59af977a34f"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Cargo Atual]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="100" height="30" uuid="6409aebd-adab-49a7-a936-1106b2698552">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/>
</reportElement>
<textFieldExpression><![CDATA[$F{UltCargo_exp}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="100" uuid="400af683-0f3e-466d-81fd-5728fb9ea2d7">
<jr:columnHeader style="Table_CH" height="60">
<staticText>
<reportElement x="0" y="0" width="100" height="60" forecolor="#FFFFFF" uuid="6b10bc3f-6b2d-45b0-8eb6-2c0213d39bea"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Nível formação acadêmica]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="100" height="30" uuid="fd0f8ebd-a8cc-4630-bbf1-75aaee74b355">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/>
</reportElement>
<textFieldExpression><![CDATA[$F{nivel_de_formacao_academica_Desc}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="100" uuid="f6fb8c6f-7d30-491c-a858-90d1ec0c9263">
<jr:columnHeader style="Table_CH" height="60">
<staticText>
<reportElement x="0" y="0" width="100" height="60" forecolor="#FFFFFF" uuid="459f1592-4eba-4cbb-a568-749a7f07ac71"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Formação Acadêmica]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="100" height="30" uuid="10057bf6-7836-4f63-9783-b3463f0cf3d9">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/>
</reportElement>
<textFieldExpression><![CDATA[$F{formacao_academica_Desc}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="100" uuid="c9bdfa6b-ac9d-482c-a1bd-552fc9b0f5c2">
<jr:columnHeader style="Table_CH" height="60">
<staticText>
<reportElement x="0" y="0" width="100" height="60" forecolor="#FFFFFF" uuid="6a11a4a8-2163-4e60-a912-035e51d1511b"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Possui experiência como Docente?]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="0" width="100" height="30" uuid="d53a8990-e900-4d65-884b-4744129ea42a">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/>
</reportElement>
<textFieldExpression><![CDATA[$F{tem_experiencia_como_docente_Desc}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</summary>
</jasperReport>
This error is only inside Jasper Studio. When i generate report inside application doens't occur errors.
I'm using JasperSoft Studio Community Edition 6.1.1
Those indicate 2 excel properties, hence they have effect only if you export to excel and are not error messages
FitRow net.sf.jasperreports.export.xls.auto.fit.row=true
Flag property that indicates whether Excel should autofit the current row height.
FitCol net.sf.jasperreports.export.xls.auto.fit.column=true
Flag property that indicates whether Excel should autofit the current column width.
You can change these by either editing the jrxml (set true or false, or remove property) or in JasperSoft Studio: select textField, Properties >> Appearance >> Edit Properties
I want my table contents to be colored depending on the conditions. My table is present in the sub datasource and the fields that are populated are from the same. Now I want to color the contents depending on some conditions.
NOTE: all the data present in the fields are of type string. So I started creating the a style and adding a condition to it using the parameter which I thought of passing from java at runtime, It says an error parameter not found. So i tried using Fields in the main report by adding the same fields of sub datasource to the main report, its says retrieving data to the field failed. How am I suppose to check for the conditions in the style.
Here's my code
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0 -->
<!-- 2016-01-13T14:56:39 -->
<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="360FeedbackJasper" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="b2b320e6-05ba-442a-ae37-11e094fd08f1">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="360feedbackAdapter"/>
<style name="Table_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="DM_STYLE">
<conditionalStyle>
<conditionExpression><![CDATA[$F{dmScore}.equals("12")]]></conditionExpression>
<style mode="Opaque" forecolor="#292323" backcolor="#D91511"/>
</conditionalStyle>
</style>
<subDataset name="table1dataset" uuid="d9e6ff71-23d5-4eb7-b8ef-fcd1bc653360">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="360feedbackAdapter"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="dmScore" class="java.lang.String">
<fieldDescription><![CDATA[dmScore]]></fieldDescription>
</field>
<field name="shScore" class="java.lang.String">
<fieldDescription><![CDATA[shScore]]></fieldDescription>
</field>
<field name="selfScore" class="java.lang.String">
<fieldDescription><![CDATA[selfScore]]></fieldDescription>
</field>
<field name="maxScore" class="java.lang.String">
<fieldDescription><![CDATA[maxScore]]></fieldDescription>
</field>
<field name="avgScore" class="java.lang.String">
<fieldDescription><![CDATA[avgScore]]></fieldDescription>
</field>
<field name="peScore" class="java.lang.String">
<fieldDescription><![CDATA[peScore]]></fieldDescription>
</field>
<field name="mergeScore" class="java.lang.String">
<fieldDescription><![CDATA[mergeScore]]></fieldDescription>
</field>
<field name="drScore" class="java.lang.String">
<fieldDescription><![CDATA[drScore]]></fieldDescription>
</field>
<field name="driver" class="java.lang.String">
<fieldDescription><![CDATA[driver]]></fieldDescription>
</field>
<field name="ques" class="java.lang.String">
<fieldDescription><![CDATA[ques]]></fieldDescription>
</field>
</subDataset>
<parameter name="OTHERS" class="java.lang.String" isForPrompting="false"/>
<parameter name="OTHERS_VALUE" class="java.lang.String" isForPrompting="false"/>
<parameter name="SHOWDM" class="java.lang.Boolean" isForPrompting="false">
<defaultValueExpression><![CDATA[new Boolean(false)]]></defaultValueExpression>
</parameter>
<parameter name="SHOWDR" class="java.lang.Boolean" isForPrompting="false">
<defaultValueExpression><![CDATA[new Boolean(false)]]></defaultValueExpression>
</parameter>
<parameter name="SHOWPE" class="java.lang.Boolean" isForPrompting="false">
<defaultValueExpression><![CDATA[new Boolean(false)]]></defaultValueExpression>
</parameter>
<parameter name="SHOWSH" class="java.lang.Boolean" isForPrompting="false">
<defaultValueExpression><![CDATA[new Boolean(false)]]></defaultValueExpression>
</parameter>
<parameter name="SHOWOT" class="java.lang.Boolean" isForPrompting="false">
<defaultValueExpression><![CDATA[new Boolean(false)]]></defaultValueExpression>
</parameter>
<parameter name="SHOWAVG" class="java.lang.Boolean" isForPrompting="false">
<defaultValueExpression><![CDATA[new Boolean(false)]]></defaultValueExpression>
</parameter>
<parameter name="DM_STYLE_PARAM" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["RED"]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[]]>
</queryString>
<field name="overAllSummaryReportWithOthers" class="java.util.List">
<fieldDescription><![CDATA[overAllSummaryReportWithOthers]]></fieldDescription>
</field>
<field name="dmScore" class="java.lang.String">
<fieldDescription><![CDATA[dmScore]]></fieldDescription>
</field>
<background>
<band splitType="Stretch"/>
</background>
.
.
.
.
<band height="261">
<componentElement>
<reportElement style="DM_STYLE" x="4" y="130" width="554" height="80" uuid="a9101195-3ec3-4fcd-acdd-f4f0665b9c5b">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
</reportElement>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="table1dataset" uuid="360bff8e-005d-461c-a00f-2c990a894735">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{overAllSummaryReportWithOthers})]]></dataSourceExpression>
</datasetRun>
<jr:column width="154" uuid="0b4b40f3-54c6-462a-90a4-d8f32a62be93">
<jr:columnHeader style="Table_CH" height="50">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="154" height="50" forecolor="#000000" backcolor="#E0E0E0" uuid="a3280d8e-c3ff-4972-91eb-6e8da7f866ee"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="SansSerif" isBold="true"/>
</textElement>
<text><![CDATA[driver]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField>
<reportElement x="0" y="0" width="154" height="30" uuid="12ab2c78-afbb-4db5-9a01-16b28cf3d9fa"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{driver}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="50" uuid="8d57520d-e982-430a-afd3-4121f4bd4600">
<jr:columnHeader style="Table_CH" height="50">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="50" height="50" forecolor="#000000" backcolor="#E0E0E0" uuid="d7a9ad1e-09b5-4791-8bd4-ca37e904fd51"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="SansSerif" isBold="true"/>
</textElement>
<text><![CDATA[maxScore]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField>
<reportElement x="0" y="0" width="50" height="30" uuid="d339341c-b0ca-4482-b0ca-651be075fe60"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{maxScore}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="50" uuid="1a391443-bc9c-4be0-86cb-a3b8dec388f4">
<jr:columnHeader style="Table_CH" height="50">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="50" height="50" forecolor="#000000" backcolor="#E0E0E0" uuid="9c73ca1a-1521-48aa-b905-2ecfeb075cbe"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="SansSerif" isBold="true"/>
</textElement>
<text><![CDATA[selfScore]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField>
<reportElement x="0" y="0" width="50" height="30" uuid="eced711e-cca2-4fd3-9d2c-46dd4787fe7d"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{selfScore}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="50" uuid="269e656a-93bf-4f52-bcd1-b3e1c1a6436e">
<printWhenExpression><![CDATA[new Boolean($P{SHOWDM})]]></printWhenExpression>
<jr:columnHeader style="Table_CH" height="50">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="50" height="50" forecolor="#000000" backcolor="#E0E0E0" uuid="26a14484-4368-4cce-b6cf-c9a4280abe0c"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="SansSerif" isBold="true"/>
</textElement>
<text><![CDATA[dmScore]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField>
<reportElement style="DM_STYLE" x="0" y="0" width="50" height="30" uuid="d43d838c-4eb7-4dd0-8afb-d7a4590dabff"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{dmScore}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="50" uuid="347a38dd-a69f-446a-92ab-3ed4502cbad6">
<printWhenExpression><![CDATA[new Boolean($P{SHOWDR})]]></printWhenExpression>
<jr:columnHeader style="Table_CH" height="50">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="50" height="50" forecolor="#000000" backcolor="#E0E0E0" uuid="ef3a228b-47f3-461c-a2c8-88c16eca5049"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="SansSerif" isBold="true"/>
</textElement>
<text><![CDATA[drScore]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField>
<reportElement x="0" y="0" width="50" height="30" uuid="a834e7b5-7413-442b-9f8e-aee67590bede"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{drScore}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="50" uuid="20c307cd-1e54-4a42-8cc4-1540da53cc57">
<printWhenExpression><![CDATA[new Boolean($P{SHOWPE})]]></printWhenExpression>
<jr:columnHeader style="Table_CH" height="50">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="50" height="50" forecolor="#000000" backcolor="#E0E0E0" uuid="a45e2224-b314-4519-aac4-e1e14500071e"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="SansSerif" isBold="true"/>
</textElement>
<text><![CDATA[peScore]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField>
<reportElement x="0" y="0" width="50" height="30" uuid="c0d60f60-20b6-414f-9c5e-9b5033386d5f"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{peScore}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="50" uuid="0e710e32-ff08-4ce4-96c3-b505e3ecb3ed">
<printWhenExpression><![CDATA[new Boolean($P{SHOWSH})]]></printWhenExpression>
<jr:columnHeader style="Table_CH" height="50">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="50" height="50" forecolor="#000000" backcolor="#E0E0E0" uuid="6eb72492-9b2a-4822-b306-903c220c40c1"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="SansSerif" isBold="true"/>
</textElement>
<text><![CDATA[shScore]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField>
<reportElement x="0" y="0" width="50" height="30" uuid="dff321ae-a25f-4224-94a6-096bcc232ce1"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{shScore}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="50" uuid="fb2ee2a9-3156-42a1-95ee-aa35fe630fc5">
<printWhenExpression><![CDATA[new Boolean($P{SHOWOT})]]></printWhenExpression>
<jr:columnHeader style="Table_CH" height="50">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="50" height="50" forecolor="#000000" backcolor="#E0E0E0" uuid="48bee6a2-8f4b-4280-9fa0-24a2dad19c06"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="SansSerif" isBold="true"/>
</textElement>
<text><![CDATA[mergeScore]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField>
<reportElement x="0" y="0" width="50" height="30" uuid="72b1c817-d6be-470d-8243-514e77b67d26"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{mergeScore}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="50" uuid="f292fb3e-0f95-4e24-8d27-763d15f390af">
<printWhenExpression><![CDATA[new Boolean($P{SHOWAVG})]]></printWhenExpression>
<jr:columnHeader style="Table_CH" height="50">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="50" height="50" forecolor="#000000" backcolor="#E0E0E0" uuid="027dbe79-5e7c-47ec-a658-5c4a1bd53699"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="SansSerif" isBold="true"/>
</textElement>
<text><![CDATA[avgScore]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField>
<reportElement x="0" y="0" width="50" height="30" uuid="c7ac4bbb-1543-4d48-a524-0dc75fc0e6b5"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{avgScore}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
<staticText>
<reportElement x="-1" y="50" width="225" height="20" uuid="5c083db9-dcc4-48e4-b72d-764490baaf03"/>
<textElement>
<font fontName="SansSerif"/>
</textElement>
<text><![CDATA[Detailed Bahavior-wise Report]]></text>
</staticText>
<textField>
<reportElement x="12" y="91" width="100" height="30" uuid="30a8aeab-8307-42e6-b375-da90350b6790"/>
<textFieldExpression><![CDATA[$P{DM_STYLE_PARAM}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>
If you define a conditional expression on a style, you can only use that style in its scope.
In your example:
<conditionExpression><![CDATA[$F{dmScore}.equals("12")]]></conditionExpression>
The scope of $F{dmScore} is when you are running the subDataset="table1dataset", hence inside of the <jr:table> tag.
This style should only be used inside of this tag, scope.
Solution:
Remove all style declaration of DM_STYLE that are out of scope as for example.
<reportElement style="DM_STYLE" x="4" y="130" width="554" height="80" uuid="a9101195-3ec3-4fcd-acdd-f4f0665b9c5b">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
</reportElement>
Regarding your previous problem when using parameter you probably forgot to pass this parameter to the jr:table and since you where using it inside you had same problem but reversed. The solution of this would have been to create same parameter in subdataset and then pass it.
<datasetRun subDataset="table1dataset" uuid="93792e42-02d5-4121-84a6-312310e190a0">
<datasetParameter name="yourParam">
<datasetParameterExpression><![CDATA[$P{yourParam}]]></datasetParameterExpression>
</datasetParameter>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{overAllSummaryReportWithOthers})]]></dataSourceExpression>
</datasetRun>