Two-page report (sub-report) does not generate second page

Asked

Viewed 92 times

1

The problem is this. I have two reports from one page each and I want the second to be the sub-report of the first. The second is in the band Summary of the first as a subreport, but when the first report is only generated one page, the second page does not appear. The second report is generated well when generated individually, but as sub-report it does not appear.

The first one is 595 x 1200 pixels (I stretched its height to 1200 pixels because it gave error to generate when I left it in the size I considered "ideal", 595 x 300 pixels, presumably because the second report did not fit on the page of the first one).

The second report has 842 x 595 pixels (A4 standard Landscape).

P.S.: I added a Break (page break) before the subreport in the Summary and two pages started to be generated, but it didn’t help, the second is empty.

Here are the sources of the first and second reports, respectively:

Customerdata.jrxml

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 6.6.0  -->
<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="CustomerData" pageWidth="595" pageHeight="1200" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="bd4d8470-7810-4186-97d6-d71f820d6812">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="Customer Info Data Adapter "/>
    <queryString>
        <![CDATA[]]>
    </queryString>
    <field name="birthday" class="java.time.LocalDate">
        <fieldDescription><![CDATA[birthday]]></fieldDescription>
    </field>
    <field name="observacao" class="java.lang.String">
        <fieldDescription><![CDATA[observacao]]></fieldDescription>
    </field>
    <field name="orderNumber" class="java.lang.Integer">
        <fieldDescription><![CDATA[orderNumber]]></fieldDescription>
    </field>
    <field name="phone" class="java.lang.String">
        <fieldDescription><![CDATA[phone]]></fieldDescription>
    </field>
    <field name="name" class="java.lang.String">
        <fieldDescription><![CDATA[name]]></fieldDescription>
    </field>
    <field name="email" class="java.lang.String">
        <fieldDescription><![CDATA[email]]></fieldDescription>
    </field>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="39" splitType="Stretch"/>
    </title>
    <pageHeader>
        <band height="26" splitType="Stretch"/>
    </pageHeader>
    <columnHeader>
        <band height="30" splitType="Stretch">
            <staticText>
                <reportElement x="483" y="0" width="49" height="30" uuid="1e51bb02-fa8b-48bd-a58d-f16139a04940"/>
                <textElement textAlignment="Center"/>
                <text><![CDATA[Email]]></text>
            </staticText>
            <staticText>
                <reportElement x="420" y="0" width="60" height="30" uuid="ff6474e7-7410-42bb-bd20-d2d36433a667"/>
                <textElement textAlignment="Center"/>
                <text><![CDATA[Aniversário]]></text>
            </staticText>
            <staticText>
                <reportElement x="360" y="0" width="60" height="30" uuid="99bf0d76-5e6b-4b1a-b31f-a4a4b772b91a"/>
                <textElement textAlignment="Center"/>
                <text><![CDATA[Nome]]></text>
            </staticText>
            <staticText>
                <reportElement x="310" y="0" width="50" height="30" uuid="a274c422-f123-42e0-b982-be9fc8cfa1f8"/>
                <textElement textAlignment="Center"/>
                <text><![CDATA[Número do pedido]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="34" splitType="Stretch">
            <textField>
                <reportElement x="310" y="0" width="50" height="30" uuid="c2580e15-8711-4f3c-a0f8-91352165bdee"/>
                <textFieldExpression><![CDATA[$F{orderNumber}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="360" y="0" width="60" height="30" uuid="ad811b37-da69-4624-9dbf-c0eeb4fd7e8b"/>
                <textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="420" y="0" width="60" height="30" uuid="0e2dcac2-0359-474d-807e-a08c135d3758"/>
                <textFieldExpression><![CDATA[$F{birthday}.format( java.time.format.DateTimeFormatter.ofPattern("dd/MM/yyyy") )]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="480" y="0" width="52" height="30" uuid="285f9ede-e240-483c-8709-3596d8e25b14"/>
                <textFieldExpression><![CDATA[$F{email}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
    <columnFooter>
        <band height="25" splitType="Stretch"/>
    </columnFooter>
    <pageFooter>
        <band height="20" splitType="Stretch">
            <textField>
                <reportElement x="440" y="0" width="60" height="18" uuid="616ea806-33dd-4e95-9881-7ec4bc81ef99"/>
                <textElement textAlignment="Right"/>
                <textFieldExpression><![CDATA["Página " + $V{PAGE_NUMBER}]]></textFieldExpression>
            </textField>
            <textField evaluationTime="Report">
                <reportElement x="500" y="0" width="53" height="18" uuid="41fdb36f-d901-4335-b402-58d51bd62a5d"/>
                <textFieldExpression><![CDATA[" de " + $V{PAGE_NUMBER}]]></textFieldExpression>
            </textField>
        </band>
    </pageFooter>
    <summary>
        <band height="215" splitType="Stretch">
            <subreport>
                <reportElement x="0" y="10" width="553" height="200" uuid="7cfb9c5c-358e-46e5-9f62-385d1d1c974f"/>
                <connectionExpression><![CDATA[$P{REPORT_CONNECTION} ]]></connectionExpression>
                <subreportExpression><![CDATA["CustomerAddresses.jasper"]]></subreportExpression>
            </subreport>
        </band>
    </summary>
</jasperReport>

Customeraddresses.jrxml

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 6.6.0  -->
<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="CustomerAddresses" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="c3c27bb5-2480-413f-87af-06a106a9b242">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="New Data Adapter "/>
    <property name="com.jaspersoft.studio.unit." value="pixel"/>
    <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
    <queryString>
        <![CDATA[]]>
    </queryString>
    <field name="number" class="java.lang.String">
        <fieldDescription><![CDATA[number]]></fieldDescription>
    </field>
    <field name="city" class="java.lang.String">
        <fieldDescription><![CDATA[city]]></fieldDescription>
    </field>
    <field name="bairro" class="java.lang.String">
        <fieldDescription><![CDATA[bairro]]></fieldDescription>
    </field>
    <field name="street" class="java.lang.String">
        <fieldDescription><![CDATA[street]]></fieldDescription>
    </field>
    <field name="complement" class="java.lang.String">
        <fieldDescription><![CDATA[complement]]></fieldDescription>
    </field>
    <field name="title" class="java.lang.String">
        <fieldDescription><![CDATA[title]]></fieldDescription>
    </field>
    <field name="cep" class="java.lang.String">
        <fieldDescription><![CDATA[cep]]></fieldDescription>
    </field>
    <field name="referencePoint" class="java.lang.String">
        <fieldDescription><![CDATA[referencePoint]]></fieldDescription>
    </field>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="79" splitType="Stretch"/>
    </title>
    <pageHeader>
        <band height="35" splitType="Stretch"/>
    </pageHeader>
    <columnHeader>
        <band height="62" splitType="Stretch">
            <staticText>
                <reportElement x="20" y="20" width="100" height="30" uuid="e0013f45-d0ed-4c51-9aca-9de907da1d9c"/>
                <textElement textAlignment="Center"/>
                <text><![CDATA[Título]]></text>
            </staticText>
            <staticText>
                <reportElement x="130" y="20" width="100" height="30" uuid="92a0e07c-b9ee-4c75-a048-689a85bf9457"/>
                <textElement textAlignment="Center"/>
                <text><![CDATA[Rua]]></text>
            </staticText>
            <staticText>
                <reportElement x="240" y="20" width="100" height="30" uuid="5f1985ff-0847-4e69-abbe-e5df3bf52ccb"/>
                <textElement textAlignment="Center"/>
                <text><![CDATA[Cidade]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="60" splitType="Stretch">
            <textField>
                <reportElement x="20" y="30" width="100" height="30" uuid="cb4f331a-5dd3-432a-808e-161d3e0cad3d"/>
                <textFieldExpression><![CDATA[$F{title}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="130" y="30" width="100" height="30" uuid="f541ed9a-0974-412b-9991-e36f9d499af8"/>
                <textFieldExpression><![CDATA[$F{street}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="240" y="30" width="100" height="30" uuid="1e81595e-56fc-4e88-8b31-9057cbb92486"/>
                <textFieldExpression><![CDATA[$F{city}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
    <columnFooter>
        <band height="45" splitType="Stretch"/>
    </columnFooter>
    <pageFooter>
        <band height="54" splitType="Stretch"/>
    </pageFooter>
    <summary>
        <band height="42" splitType="Stretch"/>
    </summary>
</jasperReport>
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.