jasperreports subreport with multiple columns does not print properly - jasper-reports

I am new to Jasper reports. I have a master report that needs to print text in 3 columns. This text is dynamic and very long (about 2 pages). By set columnCount="3", the report is print as I expected (2 pages with 3 columns in each page). However I need to insert title on top of these 3 columns of first page only. If I just add textField on top of them. The title would be overlapped by text from 2nd column. So, I add subreport under title instead and set columnCount="3" in subreport instead. However, when I generate report this time it print everything in first column of every page. Please suggest what is wrong with my configuration. Thanks in advance.
master report
<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="Master" pageWidth="612" pageHeight="792" columnWidth="552" leftMargin="30" rightMargin="30" topMargin="0" bottomMargin="10">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<parameter name="Title"/>
<parameter name="Content"/>
<queryString>
<![CDATA[]]>
</queryString>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="782" splitType="Stretch">
<textField>
<reportElement x="0" y="20" width="180" height="25"/>
<textFieldExpression><![CDATA[$P{Title}]]></textFieldExpression>
</textField>
<subreport>
<reportElement x="0" y="50" width="552" height="732"/>
<subreportParameter name="Content">
<subreportParameterExpression><![CDATA[$P{Content}]]></subreportParameterExpression>
</subreportParameter>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource()]]></dataSourceExpression>
<subreportExpression><![CDATA["subreport.jasper"]]></subreportExpression>
</subreport>
</detail>
</jasperReport>
subreport
<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="Subreport" pageWidth="552" pageHeight="732" columnCount="3" columnSpacing="6" columnWidth="180" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0"whenNoDataType="AllSectionsNoDetail">
<parameter name="Content"/>
<summary>
<band height="732" splitType="Stretch">
<textField textAdjust="StretchHeight">
<reportElement x="0" y="0" width="180" height="20"/>
<textFieldExpression><![CDATA[$P{Content}]]></textFieldExpression>
</textField>
</summary>
</jasperReport>

Related

New/different page for different organization IDs in Jaspersoft report

I'm looking for any suggestions on how to print a new/different page for different organization IDs. I created a jaspersoft grouping and was thinking of adding a print when expression to the organization ID group header. Would that be the way to go? Can anyone help me with the expression that I would need for that?
"Start New Page" (isStartNewPage="true") in the Appearance tab of the Properties for the Group Header is all that is necessary to start on a new page for every new group. Group Expression for your situation would simply be something like $F{organizationID}.
Here's an example that groups on $F{city}, lists $F{CustomerID} and starts a new page for every new $F{city}:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.20.0.final using JasperReports Library version 6.1.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_" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="62ac07f5-f11e-4179-aedb-a42e850c1ea8">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="northwind"/>
<queryString language="jsonql">
<![CDATA[Northwind.Customers]]>
</queryString>
<field name="City" class="java.lang.String">
<property name="net.sf.jasperreports.jsonql.field.expression" value="City"/>
<fieldDescription><![CDATA[City]]></fieldDescription>
</field>
<field name="CustomerID" class="java.lang.String">
<property name="net.sf.jasperreports.json.field.expression" value="CustomerID"/>
<fieldDescription><![CDATA[CustomerID]]></fieldDescription>
</field>
<group name="City" isStartNewPage="true">
<groupExpression><![CDATA[$F{City}]]></groupExpression>
</group>
<columnHeader>
<band height="12" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="100" height="12" uuid="bdf3f7ab-bf1d-451e-a2ad-831a551ce388"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[Company Name]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="12" splitType="Stretch">
<textField>
<reportElement x="0" y="0" width="100" height="12" uuid="c7bcc5aa-8051-48ad-a0d6-fe27c68da204"/>
<textFieldExpression><![CDATA[$F{CustomerID}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>

The subreport with static text is not showing

I have created a very simple sub report "dummy_subreport.jrxml", which prints a static text.
dummy_subreport.jasper is included in the report "Calling_report.jrxml", which also prints a static text and includes the subreport.
However, the subreport is not getting displayed when the main report is invoked.
Subreport code is
<?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="dummy_subreport" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<queryString>
<![CDATA[]]>
</queryString>
<pageHeader>
<band height="50">
<staticText>
<reportElement x="90" y="0" width="286" height="30"/>
<text><![CDATA[From sub report]]></text>
</staticText>
</band>
</pageHeader>
<detail>
<band height="125" splitType="Stretch"/>
</detail>
</jasperReport>
The calling report is
<?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="Calling_report" pageWidth="595" pageHeight="842" columnWidth="555">
<queryString>
<![CDATA[]]>
</queryString>
<detail>
<band height="133" splitType="Stretch">
<staticText>
<reportElement x="60" y="12" width="410" height="30"/>
<text><![CDATA[HELLO WORLD IN THE COVERING REPORT]]></text>
</staticText>
<subreport>
<reportElement x="261" y="58" width="200" height="52"/>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource()]]></dataSourceExpression>
<subreportExpression><![CDATA["dummy_subreport.jasper"]]></subreportExpression>
</subreport>
</band>
</detail>
</jasperReport>
Any help in this regard is greatly appreciated.

How to print text for each iteration in the detail except for the last one?

I have a subreport that iterates names. I want to print a the text "or" on every loop, except for the last one. Right now I'm doing a suggested solution in this question, but it still prints in the last iterate.
Here is a sample of what I have right now:
There is still an extra or in the end of the subreport.
Current subreport source code I have right now:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.5.1.final using JasperReports Library version 6.5.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="paiwi-signatories-name-only-subreport" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="8f474d5a-0cca-4c5f-807e-71af8848276f">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="signatoryJSON"/>
<queryString language="json">
<![CDATA[signatoryNames]]>
</queryString>
<field name="name" class="java.lang.String">
<fieldDescription><![CDATA[name]]></fieldDescription>
</field>
<field name="address" class="java.lang.String"/>
<variable name="signatoryCurrentCount" class="java.lang.Integer" resetType="None">
<variableExpression><![CDATA[$V{nameGroup_COUNT}]]></variableExpression>
</variable>
<group name="nameGroup">
<groupExpression><![CDATA[$F{name}]]></groupExpression>
</group>
<detail>
<band height="36" splitType="Stretch">
<textField isBlankWhenNull="true">
<reportElement positionType="Float" x="-20" y="-20" width="260" height="20" uuid="220a59b9-595b-4149-badd-f4a1ecff36c5"/>
<textElement>
<font fontName="Times New Roman" size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
</textField>
<textField evaluationTime="Auto" isBlankWhenNull="true">
<reportElement positionType="Float" x="0" y="0" width="100" height="20" isRemoveLineWhenBlank="true" uuid="afda4fcc-78fc-46f9-8c5c-2e0c4f04dfa5"/>
<textFieldExpression><![CDATA[$V{signatoryCurrentCount}.equals($V{nameGroup_COUNT}) ? "or" : ""]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
How can I avoid to print the last textField after last record?
You can try a simple thing, put the 2 variables in your report, I think you already know how many pages your report will contain, and then change the printWhenExpression statement to the value of your page, for example your report contains 20 pages, then in your variable change the print condition to PAGE_NUMBER==20 and PAGE_NUMBER < 20 for the other one.
Good luck.
If you like to leverage evalutationTime="Auto"
Variables will be evaluated at a time corresponding to their reset type
From EvaluationTimeEnum
You need 2 variables with different reset time. Adapting to your example a solution can be:
Setting your signatoryCurrentCount to the REPORT_COUNT but reseting everytime your group change (hence on every record in your example)
<variable name="signatoryCurrentCount" class="java.lang.Integer" resetType="Group" resetGroup="nameGroup">
<variableExpression><![CDATA[$V{REPORT_COUNT}]]></variableExpression>
</variable>
Then you compare this with the built in variable $V{REPORT_COUNT} that have reset type report
<textFieldExpression><![CDATA[$V{signatoryCurrentCount}<$V{REPORT_COUNT} ? "or" : ""]]></textFieldExpression>
To understand the expression with reset type "Auto", the signatoryCurrentCount will have 1,2,3 (reset's at group) and $V{REPORT_COUNT} always 3 (reset at report).
Full Example
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="paiwi-signatories-name-only-subreport" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="8f474d5a-0cca-4c5f-807e-71af8848276f">
<queryString language="json">
<![CDATA[signatoryNames]]>
</queryString>
<field name="name" class="java.lang.String">
<fieldDescription><![CDATA[name]]></fieldDescription>
</field>
<field name="address" class="java.lang.String"/>
<variable name="signatoryCurrentCount" class="java.lang.Integer" resetType="Group" resetGroup="nameGroup">
<variableExpression><![CDATA[$V{REPORT_COUNT}]]></variableExpression>
</variable>
<group name="nameGroup">
<groupExpression><![CDATA[$F{name}]]></groupExpression>
</group>
<detail>
<band height="36" splitType="Stretch">
<textField isBlankWhenNull="true">
<reportElement positionType="Float" x="-20" y="-20" width="260" height="20" uuid="220a59b9-595b-4149-badd-f4a1ecff36c5"/>
<textElement>
<font fontName="Times New Roman" size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
</textField>
<textField evaluationTime="Auto" isBlankWhenNull="true">
<reportElement positionType="Float" x="0" y="0" width="100" height="20" isRemoveLineWhenBlank="true" uuid="afda4fcc-78fc-46f9-8c5c-2e0c4f04dfa5"/>
<textFieldExpression><![CDATA[$V{signatoryCurrentCount}<$V{REPORT_COUNT} ? "or" : ""]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
output
Do note: using evaluationTime="Auto" is resource intensive for jasper report, in most cases I would suggest that users pass in datasource the totale number of records, the report will be generated faster.

Why is piechart in subreport is not displayed?

With the help of iReport 5.6.0 tool, I have created a master report. Then I have drag and drop a subreport to the repot group band of the master report. I have defined the SQL query and set the key and value via wizard. After that I have added a pie chart to the subreport.
When I run the subreport individually, it works fine with the provided SQL query. But when I run the master report via DynamicReports with Java code, it seems that the query does not work and return null values. As a result, no chart is displayed.
Is there any missing steps in my approach? Do I need to map/link somehow the subreport query results to master report?
Master report 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="templatedesign2" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="575" leftMargin="10" rightMargin="10" topMargin="10" bottomMargin="10" uuid="8c9654e9-6770-46c4-a4d0-4bdf99195b70">
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["D:\\DynamicReports\\src\\subreport\\"]]></defaultValueExpression>
</parameter>
<field name="item" class="java.lang.String"/>
<field name="reportTitle" class="java.lang.String"/>
<field name="customerName" class="java.lang.String"/>
<group name="Intro">
<groupHeader>
<band height="255">
<subreport isUsingCache="false">
<reportElement x="0" y="160" width="575" height="77" uuid="eb90e8b6-2860-4c94-ad10-3eb5031502fc"/>
<subreportParameter name="SUBREPORT_DIR">
<subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression>
</subreportParameter>
<dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "templatereport2_subreport3.jasper"]]></subreportExpression>
</subreport>
</band>
</groupHeader>
</group>
</jasperReport>
subreport 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="templatereport2_subreport3" pageWidth="555" pageHeight="802" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" isTitleNewPage="true" uuid="3dc0ebf2-660d-4d0c-af85-ccae1f01bdee">
<parameter name="runCycleId" class="java.lang.String"/>
<queryString>
<![CDATA[SELECT
count(status) AS count,
case when status=TRUE then 'Succeeded'else 'Failed'end AS status
FROM
"dbtable" dbtable
WHERE
id = 157
GROUP BY
status]]>
</queryString>
<field name="count" class="java.lang.Long"/>
<field name="status" class="java.lang.String"/>
<title>
<band height="351" splitType="Stretch">
<pie3DChart>
<chart evaluationTime="Report">
<reportElement x="20" y="22" width="415" height="244" uuid="a43afa44-c4e5-4ad5-b06e-8922128bcdaf"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<pieDataset>
<keyExpression><![CDATA[$F{status}]]></keyExpression>
<valueExpression><![CDATA[$F{count}]]></valueExpression>
</pieDataset>
<pie3DPlot>
<plot/>
<itemLabel/>
</pie3DPlot>
</pie3DChart>
<textField>
<reportElement x="134" y="292" width="100" height="20" uuid="2726affe-1fef-45a1-abc8-8da8c9856e42"/>
<textFieldExpression><![CDATA[$F{count}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="20" y="292" width="100" height="20" uuid="fa4e41c0-b4f4-443c-ab9e-3cf048a3f520"/>
<textFieldExpression><![CDATA[$F{status}]]></textFieldExpression>
</textField>
</band>
</title>
</jasperReport>
Can you please advise?
Since you are using a query in the subreport you should pass the connection, not the datasource to it.
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
In your example
<subreport isUsingCache="false">
reportElement x="0" y="160" width="575" height="77" uuid="eb90e8b6-2860-4c94-ad10-3eb5031502fc"/>
<subreportParameter name="SUBREPORT_DIR">
<subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "templatereport2_subreport3.jasper"]]></subreportExpression>
</subreport>

How to split to new page when isIgnorePagination?

Using Jaspersoft studio 6.2.
A main report with detail and summary bands. A sub report in the summary band of the main report. The main report itself (when without the subreport) will split into two pages, so I checked isIgnorePagination and the main report (when without subreport) comes out as single page.
The subreport itself split to 9 pages by default, when I checked isIgnorePagination it comes out as one single page. Fine. When I put the subreport in the main report with all the settings above, it comes out as one single page. How can I make the main report in one page and subreport in another page (so two pages in total)?
EDIT
Tried break component, it works but there is still a problem. The page height of the main report has to be set to be big enough to include both main report and subreport, otherwise there will be more than 2 pages, but that will leave too much blank at the bottom of the main report. Below is an example to show what I meant.
main report:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0 -->
<!-- 2016-04-26T16:13:43 -->
<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="test11" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="ce9d78e1-7194-4754-aaf9-93e871d2a5cf">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="datamart"/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<queryString>
<![CDATA[select 1 as a
union all select 2 as a]]>
</queryString>
<field name="a" class="java.lang.Integer"/>
<variable name="Total" class="java.lang.Integer" calculation="Sum">
<variableExpression><![CDATA[$F{a}]]></variableExpression>
</variable>
<background>
<band splitType="Stretch"/>
</background>
<columnHeader>
<band height="50">
<staticText>
<reportElement x="54" y="0" width="100" height="30" uuid="e9116c0f-c827-4cb3-95d1-9155f4be7cb7"/>
<text><![CDATA[a]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="49" splitType="Stretch">
<textField>
<reportElement x="50" y="10" width="100" height="30" uuid="79fa53fa-48e2-43d0-96a4-0cda54e95c25"/>
<textFieldExpression><![CDATA[$F{a}]]></textFieldExpression>
</textField>
</band>
</detail>
<summary>
<band height="297" splitType="Stretch">
<textField>
<reportElement mode="Opaque" x="52" y="16" width="100" height="30" backcolor="#C4E5F6" uuid="2a393151-947e-4f1d-ab24-e456ce56bd19"/>
<textFieldExpression><![CDATA[$V{Total}]]></textFieldExpression>
</textField>
<subreport>
<reportElement x="62" y="97" width="200" height="200" uuid="b342cbae-597b-4ca5-b00d-3a4d047910f8"/>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA["test12.jasper"]]></subreportExpression>
</subreport>
<break>
<reportElement x="0" y="60" width="619" height="1" uuid="ccc2155d-6a2e-4c23-a972-88bb871cb17d"/>
</break>
</band>
</summary>
</jasperReport>
sub report
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0 -->
<!-- 2016-04-26T16:14:10 -->
<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="test12" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="3601f813-f6da-4105-a4d8-5c1ee1dd54d4">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="datamart"/>
<queryString>
<![CDATA[select 10 as col
union all select 20 as col]]>
</queryString>
<field name="col" class="java.lang.Integer"/>
<variable name="total" class="java.lang.Integer" calculation="Sum">
<variableExpression><![CDATA[$F{col}]]></variableExpression>
</variable>
<background>
<band splitType="Stretch"/>
</background>
<columnHeader>
<band height="61" splitType="Stretch">
<staticText>
<reportElement x="73" y="0" width="100" height="30" uuid="5f2cfa26-c7ab-413e-94cf-80c1f1b288eb"/>
<text><![CDATA[col]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="125" splitType="Stretch">
<textField>
<reportElement x="73" y="90" width="100" height="30" uuid="3af983fb-00e2-4bb9-9e91-2d2214ca95d7"/>
<textFieldExpression><![CDATA[$F{col}]]></textFieldExpression>
</textField>
</band>
</detail>
<summary>
<band height="49" splitType="Stretch">
<textField>
<reportElement mode="Opaque" x="74" y="19" width="100" height="30" backcolor="#FFCC33" uuid="b333fb92-8aa8-4f00-9a1a-db24657d5521"/>
<textFieldExpression><![CDATA[$V{total}]]></textFieldExpression>
</textField>
</band>
</summary>
</jasperReport>
There is a break in the main report, this works fine, 2 pages one for the main report and one for the sub report, but the main report leaves too much blank at the bottom, if I reduce the height of the main report (e.g. to 400 pixel), there will be more than 2 pages. Is it possible to get just 2 pages without too much blank?
To achieve different size for each page you need to use the attribute, isIgnorePagination="true" on the jasperReport tag.
When isIgnorePagination is true the break element is ignored by default you need to enabled it by setting this property net.sf.jasperreports.page.break.no.pagination to apply
ignore - page breaks are ignored in non paginated reports. (default) apply -
page breaks are honoured in non paginated reports.
<property name="net.sf.jasperreports.page.break.no.pagination" value="apply"/>
This will enable the break component and you can manuale break to new page using
<break>
<reportElement x="0" y="0" width="100" height="1" uuid="604c65b5-1127-4874-a63c-9b1a98dbf25c"/>
</break>