Добавить подотчет, который получает данные из того же источника данных, что и основной отчет - PullRequest
0 голосов
/ 10 апреля 2020

У меня есть основной отчет, который состоит из трех подчиненных отчетов. Мой источник данных - JSON. Два из них используют вложенный объект в JSON. В то время как третий является вложенным отчетом, который использует объект первого уровня, а внутри вложенного отчета есть другой вложенный отчет, который использует один из вложенных объектов.

Все работает, за исключением того, что последний подотчет (тот, что с другим подотчетом) не отображается в pdf. Но файл .jasper показывает все отлично.

Я подозреваю, что проблема может быть здесь, в Master, но я пытался использовать .subDataSource ("data") и не работал.

<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE})]]></dataSourceExpression>
                <subreportExpression><![CDATA["PaymentDetails.jasper"]]></subreportExpression>

Здесь, если мой основной источник:


<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.12.2.final using JasperReports Library version 6.12.2-75c5e90a222ab406e416cbf590a5397028a52de3  -->
<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="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="4f5fe1d5-cd4c-40e9-84cb-283072ae1080">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="DataAdapterDummyJSON.xml"/>
    <queryString language="json">
        <![CDATA[data]]>
    </queryString>
    <field name="idcNumber" class="java.lang.Long">
        <property name="net.sf.jasperreports.json.field.expression" value="idcNumber"/>
        <fieldDescription><![CDATA[idcNumber]]></fieldDescription>
    </field>
    <field name="cesco" class="java.lang.String">
        <property name="net.sf.jasperreports.json.field.expression" value="cesco"/>
        <fieldDescription><![CDATA[cesco]]></fieldDescription>
    </field>
    <field name="digitalExpirationDate" class="java.lang.String">
        <property name="net.sf.jasperreports.json.field.expression" value="digitalExpirationDate"/>
        <fieldDescription><![CDATA[digitalExpirationDate]]></fieldDescription>
    </field>
    <field name="licenseRenewalDate" class="java.lang.String">
        <property name="net.sf.jasperreports.json.field.expression" value="licenseRenewalDate"/>
        <fieldDescription><![CDATA[licenseRenewalDate]]></fieldDescription>
    </field>
    <field name="reportCreationDate" class="java.lang.String">
        <property name="net.sf.jasperreports.json.field.expression" value="reportCreationDate"/>
        <fieldDescription><![CDATA[reportCreationDate]]></fieldDescription>
    </field>
    <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="realId" class="java.lang.Boolean">
        <property name="net.sf.jasperreports.json.field.expression" value="realId"/>
        <fieldDescription><![CDATA[realId]]></fieldDescription>
    </field>
    <field name="requiredDocuments" class="java.lang.String">
        <property name="net.sf.jasperreports.json.field.expression" value="requiredDocuments"/>
        <fieldDescription><![CDATA[requiredDocuments]]></fieldDescription>
    </field>
    <field name="finesCount" class="java.lang.Long">
        <property name="net.sf.jasperreports.json.field.expression" value="finesCount"/>
        <fieldDescription><![CDATA[finesCount]]></fieldDescription>
    </field>
    <field name="finesTotal" class="java.math.BigDecimal">
        <property name="net.sf.jasperreports.json.field.expression" value="finesTotal"/>
        <fieldDescription><![CDATA[finesTotal]]></fieldDescription>
    </field>
    <field name="lateFees" class="java.math.BigDecimal">
        <property name="net.sf.jasperreports.json.field.expression" value="lateFees"/>
        <fieldDescription><![CDATA[lateFees]]></fieldDescription>
    </field>
    <field name="finesDiscount" class="java.math.BigDecimal">
        <property name="net.sf.jasperreports.json.field.expression" value="finesDiscount"/>
        <fieldDescription><![CDATA[finesDiscount]]></fieldDescription>
    </field>
    <field name="totalPayment" class="java.math.BigDecimal">
        <property name="net.sf.jasperreports.json.field.expression" value="totalPayment"/>
        <fieldDescription><![CDATA[totalPayment]]></fieldDescription>
    </field>
    <field name="transactionReceipt" class="java.lang.Long">
        <property name="net.sf.jasperreports.json.field.expression" value="transactionReceipt"/>
        <fieldDescription><![CDATA[transactionReceipt]]></fieldDescription>
    </field>
    <field name="charges" class="java.lang.String">
        <property name="net.sf.jasperreports.json.field.expression" value="charges"/>
        <fieldDescription><![CDATA[charges]]></fieldDescription>
    </field>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="77" splitType="Stretch">
            <image>
                <reportElement x="1" y="8" width="125" height="55" uuid="5a5eb6db-21f4-4b5f-9300-0548557abcf5">
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
                </reportElement>
                <imageExpression><![CDATA["/ImageAssets/Logo_CESCO_Black_300-01.png"]]></imageExpression>
            </image>
            <image>
                <reportElement x="481" y="0" width="72" height="72" uuid="98c2d26d-807e-4b19-883a-c6bff6fdf73c">
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
                </reportElement>
                <imageExpression><![CDATA["https://upload.wikimedia.org/wikipedia/commons/thumb/4/41/QR_Code_Example.svg/1200px-QR_Code_Example.svg.png"]]></imageExpression>
            </image>
            <image>
                <reportElement x="1" y="8" width="125" height="55" uuid="e10d2e29-5aad-43a9-8d2f-5c83ae03f97c">
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
                </reportElement>
                <imageExpression><![CDATA["/ImageAssets/Logo_CESCO_Black_300-01.png"]]></imageExpression>
            </image>
            <image>
                <reportElement x="481" y="0" width="72" height="72" uuid="ee058ffd-c593-4b2c-b881-090fc5609564">
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
                </reportElement>
                <imageExpression><![CDATA["https://upload.wikimedia.org/wikipedia/commons/thumb/4/41/QR_Code_Example.svg/1200px-QR_Code_Example.svg.png"]]></imageExpression>
            </image>
        </band>
    </title>
    <pageHeader>
        <band height="47" splitType="Stretch">
            <staticText>
                <reportElement x="-20" y="15" width="595" height="30" uuid="0bb6a402-68b5-4219-9b02-6ebe161a9541"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="SansSerif" size="18" isBold="true"/>
                </textElement>
                <text><![CDATA[RENOVACIÓN LICENCIA DE CONDUCIR]]></text>
            </staticText>
        </band>
    </pageHeader>
    #Removed some code

                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font size="14" isBold="false" isItalic="false"/>
                </textElement>
                <text><![CDATA[CATEGORÍA:]]></text>
            </staticText>
            <staticText>
                <reportElement x="319" y="148" width="12" height="19" uuid="9f3ecc36-81ae-47b3-9ea3-b4dcc512c0ed">
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.y" value="px"/>
                    <printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
                </reportElement>
                <textElement verticalAlignment="Middle">
                    <font fontName="SansSerif" size="16" isBold="true"/>
                </textElement>
                <text><![CDATA[3]]></text>
            </staticText>
            <staticText>
                <reportElement x="226" y="167" width="80" height="19" uuid="d354a581-b0c4-4bf4-8c7d-69d074a68a55">
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font size="14" isBold="false" isItalic="false"/>
                </textElement>
                <text><![CDATA[REAL ID:]]></text>
            </staticText>
            <textField>
                <reportElement x="291" y="166" width="27" height="19" uuid="23265294-9d3e-4477-95b0-e909a00c94cb">
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
                </reportElement>
                <textElement verticalAlignment="Middle">
                    <font size="16" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{realId}==true? "Sí":"No"]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="390" y="149" width="165" height="19" uuid="1e9fa600-6ec5-4c51-aa75-dbf1baf0141f">
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font size="14" isBold="false" isItalic="false"/>
                </textElement>
                <text><![CDATA[EXPIRACIÓN LICENCIA²: ]]></text>
            </staticText>
            <staticText>
                <reportElement x="390" y="165" width="100" height="19" uuid="2e0ebfac-95d6-42fa-a2cf-d66239ce7cb1">
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font size="14" isBold="true"/>
                </textElement>
                <text><![CDATA[03.28.2020]]></text>
            </staticText>
            <staticText>
                <reportElement x="1" y="227" width="552" height="22" uuid="d9bad373-99d0-4c17-93d0-fd3b344ea75e">
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font size="12" isBold="false" isItalic="false"/>
                </textElement>
                <text><![CDATA[Este comunicado también ha sido enviado a su correo electrónico. ]]></text>
            </staticText>
            <staticText>
                <reportElement x="1" y="262" width="552" height="22" uuid="65d43d45-15cc-4583-b692-fa3134371d23">
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font size="12" isBold="false" isItalic="false"/>
                </textElement>
                <text><![CDATA[Documentos necesarios para el recogido de la licencia:]]></text>
            </staticText>
            <subreport>
                <reportElement x="-1" y="304" width="200" height="200" uuid="c02143c5-340d-4ea3-9273-6943e1c584d4"/>
                <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("requiredDocuments")]]></dataSourceExpression>
                <subreportExpression><![CDATA["RequiredDocuments.jasper"]]></subreportExpression>
            </subreport>
            <staticText>
                <reportElement x="-1" y="527" width="489" height="30" uuid="3f6f6d12-3927-44cc-b9f3-14209f477ad7">
                    <printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font size="12"/>
                </textElement>
                <text><![CDATA[De no tener algunos de estos documentos favor de seguir las instrucciones adjuntas. ]]></text>
            </staticText>
        </band>
        <band height="267">
            <subreport>
                <reportElement x="0" y="0" width="200" height="200" uuid="609a4eec-e75a-4a28-8581-68143de0ca0f"/>
                <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("requiredDocuments")]]></dataSourceExpression>
                <subreportExpression><![CDATA["Instructions.jasper"]]></subreportExpression>
            </subreport>
        </band>
        <band height="327">
            <subreport>
                <reportElement x="0" y="0" width="200" height="200" uuid="1b33f2fc-6d44-4325-a789-0fc342a008ff"/>
                <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE})]]></dataSourceExpression>
                <subreportExpression><![CDATA["PaymentDetails.jasper"]]></subreportExpression>
            </subreport>
        </band>
        <band height="273"/>
    </detail>
</jasperReport>

Вот подотчет:


<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.12.2.final using JasperReports Library version 6.12.2-75c5e90a222ab406e416cbf590a5397028a52de3  -->
<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="PaymentDetails" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="0dc66f1e-e4eb-4e3d-8d6c-ae4885e87beb">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="DataAdapterDummyJSON.xml"/>
    <queryString language="json">
        <![CDATA[data]]>
    </queryString>
    <field name="idcNumber" class="java.lang.Long">
        <property name="net.sf.jasperreports.json.field.expression" value="idcNumber"/>
        <fieldDescription><![CDATA[idcNumber]]></fieldDescription>
    </field>
    <field name="cesco" class="java.lang.String">
        <property name="net.sf.jasperreports.json.field.expression" value="cesco"/>
        <fieldDescription><![CDATA[cesco]]></fieldDescription>
    </field>
    <field name="digitalExpirationDate" class="java.lang.String">
        <property name="net.sf.jasperreports.json.field.expression" value="digitalExpirationDate"/>
        <fieldDescription><![CDATA[digitalExpirationDate]]></fieldDescription>
    </field>
    <field name="licenseRenewalDate" class="java.lang.String">
        <property name="net.sf.jasperreports.json.field.expression" value="licenseRenewalDate"/>
        <fieldDescription><![CDATA[licenseRenewalDate]]></fieldDescription>
    </field>
    <field name="reportCreationDate" class="java.lang.String">
        <property name="net.sf.jasperreports.json.field.expression" value="reportCreationDate"/>
        <fieldDescription><![CDATA[reportCreationDate]]></fieldDescription>
    </field>
    <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="realId" class="java.lang.String">
        <property name="net.sf.jasperreports.json.field.expression" value="realId"/>
        <fieldDescription><![CDATA[realId]]></fieldDescription>
    </field>
    <field name="requiredDocuments" class="java.lang.String">
        <property name="net.sf.jasperreports.json.field.expression" value="requiredDocuments"/>
        <fieldDescription><![CDATA[requiredDocuments]]></fieldDescription>
    </field>
    <field name="finesCount" class="java.lang.Long">
        <property name="net.sf.jasperreports.json.field.expression" value="finesCount"/>
        <fieldDescription><![CDATA[finesCount]]></fieldDescription>
    </field>
    <field name="finesTotal" class="java.math.BigDecimal">
        <property name="net.sf.jasperreports.json.field.expression" value="finesTotal"/>
        <fieldDescription><![CDATA[finesTotal]]></fieldDescription>
    </field>
    <field name="lateFees" class="java.math.BigDecimal">
        <property name="net.sf.jasperreports.json.field.expression" value="lateFees"/>
        <fieldDescription><![CDATA[lateFees]]></fieldDescription>
    </field>
    <field name="finesDiscount" class="java.math.BigDecimal">
        <property name="net.sf.jasperreports.json.field.expression" value="finesDiscount"/>
        <fieldDescription><![CDATA[finesDiscount]]></fieldDescription>
    </field>
    <field name="totalPayment" class="java.math.BigDecimal">
        <property name="net.sf.jasperreports.json.field.expression" value="totalPayment"/>
        <fieldDescription><![CDATA[totalPayment]]></fieldDescription>
    </field>
    <field name="transactionReceipt" class="java.lang.Long">
        <property name="net.sf.jasperreports.json.field.expression" value="transactionReceipt"/>
        <fieldDescription><![CDATA[transactionReceipt]]></fieldDescription>
    </field>
    <field name="charges" class="java.lang.String">
        <property name="net.sf.jasperreports.json.field.expression" value="charges"/>
        <fieldDescription><![CDATA[charges]]></fieldDescription>
    </field>
    <title>
        <band height="78" splitType="Stretch">
            <staticText>
                <reportElement x="3" y="20" width="550" height="30" uuid="9ce0ef48-484d-47ab-bf80-d0bb95fd1088">
                    <printWhenExpression><![CDATA[$V{PAGE_NUMBER}==1]]></printWhenExpression>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="SansSerif" size="18" isBold="true"/>
                </textElement>
                <text><![CDATA[RENOVACIÓN LICENCIA DE CONDUCIR]]></text>
            </staticText>
        </band>
    </title>
    <detail>
        <band height="394" splitType="Stretch">
            <staticText>
                <reportElement x="64" y="43" width="180" height="19" uuid="f08338a2-802f-4364-acd2-27b71f9d7471">
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement verticalAlignment="Middle">
                    <font size="14" isBold="true"/>
                </textElement>
                <text><![CDATA[Total de Multas Pagadas]]></text>
            </staticText>
            <ellipse>
                <reportElement x="417" y="35" width="35" height="35" backcolor="#000000" uuid="1c9546ef-1912-4bd7-8262-a98eb975a369">
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
            </ellipse>
            <textField>
                <reportElement x="418" y="42" width="33" height="20" forecolor="#FFFFFF" uuid="0a905bc6-f610-473b-a072-82b4fedbe3df"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{finesCount}]]></textFieldExpression>
            </textField>
            <rectangle>
                <reportElement x="-20" y="86" width="595" height="194" forecolor="#E7EAF3" backcolor="#E7EAF3" uuid="54b7e75d-d7bf-49b6-9e3b-4f31e55b83f0"/>
            </rectangle>
            <staticText>
                <reportElement x="100" y="105" width="144" height="20" uuid="47909c9c-799b-49aa-8729-5ca6c67253e8">
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Right" verticalAlignment="Middle">
                    <font size="15"/>
                </textElement>
                <text><![CDATA[TOTAL MULTAS]]></text>
            </staticText>
            <textField>
                <reportElement x="320" y="105" width="132" height="20" uuid="27d867e0-05ad-441c-9fc9-6c15cc880f16">
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Right" verticalAlignment="Middle">
                    <font size="15" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA["$"+ new DecimalFormat("0,000.00").format($F{finesTotal})]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="100" y="125" width="144" height="20" uuid="b827a62f-0a49-4ccd-9e16-19a774cc7160">
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Right" verticalAlignment="Middle">
                    <font size="15"/>
                </textElement>
                <text><![CDATA[TOTAL RECARGOS]]></text>
            </staticText>
            <textField>
                <reportElement x="320" y="125" width="132" height="20" uuid="d85a9481-6155-49c6-b6ce-702fcdaa1d28">
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Right" verticalAlignment="Middle">
                    <font size="15" isBold="true" isStrikeThrough="true"/>
                </textElement>
                <textFieldExpression><![CDATA["$"+ new DecimalFormat("0.00").format($F{lateFees})]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="100" y="146" width="144" height="20" uuid="10fe7f0c-1150-4f81-b4ac-8a1e4af1d436">
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Right" verticalAlignment="Middle">
                    <font size="15"/>
                </textElement>
                <text><![CDATA[DESCUENTO]]></text>
            </staticText>
            <textField>
                <reportElement x="320" y="146" width="132" height="20" uuid="0afe46fe-e810-4814-b097-7516857e3d4a">
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Right" verticalAlignment="Middle">
                    <font size="15" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA["$"+ new DecimalFormat("0,000.00").format($F{finesDiscount})]]></textFieldExpression>
            </textField>
            <subreport>
                <reportElement x="-20" y="170" width="595" height="60" uuid="3dd7434b-6819-47b1-a8ac-f06ae115a79b"/>
                <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("charges")]]></dataSourceExpression>
                <subreportExpression><![CDATA["Charges.jasper"]]></subreportExpression>
            </subreport>
            <staticText>
                <reportElement x="100" y="252" width="144" height="20" uuid="7f82cf48-5018-4599-b347-1dc8c2d526db">
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Right" verticalAlignment="Middle">
                    <font size="15" isBold="true"/>
                </textElement>
                <text><![CDATA[TOTAL]]></text>
            </staticText>
            <textField>
                <reportElement x="320" y="252" width="132" height="20" uuid="8ad2b87b-dd19-4805-a209-627bdfade9c2">
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Right" verticalAlignment="Middle">
                    <font size="15" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA["$"+ new DecimalFormat("0,000.00").format($F{totalPayment})]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="19" y="300" width="53" height="19" uuid="897df478-65c7-4c00-8329-2e1aa4e6aa49">
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                </reportElement>
                <textElement verticalAlignment="Middle">
                    <font size="14"/>
                </textElement>
                <text><![CDATA[FECHA:]]></text>
            </staticText>
            <textField pattern="MM.dd.yyyy">
                <reportElement x="75" y="300" width="100" height="19" uuid="0664dddc-1ac7-4c4f-b4be-f39a03f783a7">
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement verticalAlignment="Middle">
                    <font size="14" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="20" y="320" width="170" height="19" uuid="0db8a6d8-eec7-4823-aacd-21231b060fd7">
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                </reportElement>
                <textElement verticalAlignment="Middle">
                    <font size="14"/>
                </textElement>
                <text><![CDATA[RECIBO TRANSACCIÓN:]]></text>
            </staticText>
            <textField>
                <reportElement x="195" y="319" width="85" height="19" uuid="f1228671-c223-4289-b5fa-7981036edcc4">
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement verticalAlignment="Middle">
                    <font size="14" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{transactionReceipt}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="300" y="303" width="70" height="19" uuid="a099e44b-9331-471a-91b1-10b5fbdc1b87">
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                </reportElement>
                <textElement verticalAlignment="Middle">
                    <font size="14"/>
                </textElement>
                <text><![CDATA[MOTIVO:]]></text>
            </staticText>
            <staticText>
                <reportElement x="300" y="319" width="260" height="19" uuid="dada3803-b9bc-40f2-8e00-61901fbc3d40">
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    <property name="com.jaspersoft.studio.unit.width" value="px"/>
                </reportElement>
                <textElement verticalAlignment="Middle">
                    <font size="14" isBold="true"/>
                </textElement>
                <text><![CDATA[Renovación de Licencia de Conducir]]></text>
            </staticText>
        </band>
    </detail>
</jasperReport>

И это JSON файл, который я использую:

{
  "data": {
    "idcNumber": 1234567890123,
    "cesco": "Sagrado Corazón",
    "digitalExpirationDate": "2020-04-07 09:27:45",
    "licenseRenewalDate": "2020-04-07 09:27:45",
    "reportCreationDate": "2020-04-07 09:27:45",
    "firstName": "Hermanegildo M.",
    "lastName": "Maldonado Rodríguez",
    "realId": true,
    "requiredDocuments": [
      {
        "documentNumber": 1,
        "title": "Este Documento Impreso o Digital",
        "instruction": ""
      },
      {
        "documentNumber": 2,
        "title": "Licencia Actual",
        "instruction": ""
      },{
        "documentNumber": 3,
        "title": "Seguro Social / Pasaporte",
        "instruction": "<b"
      },{
        "documentNumber": 4,
        "title": "Recibo Agua, Luz, etc.",
        "instruction": ""
      },{
        "documentNumber": 5,
        "title": "Foto y Firma Digitalizada",
        "instruction": "En "
      }

    ],
    "finesCount": 25,
    "finesTotal": 15000.00,
    "lateFees": 60.00,
    "finesDiscount": 3000.00,
    "totalPayment": 12022.00,
    "transactionReceipt": 120459593030,
    "charges": [
      {
        "chargeName": "Renovación Digital",
        "chargeAmount": 11.00
      },
      {
        "chargeName": "Renovación",
        "chargeAmount": 11.00
      }
    ]
  }
}

1 Ответ

0 голосов
/ 10 апреля 2020

Самым быстрым решением было бы повторно использовать тот же адаптер данных в третьем подотчете, поскольку он, похоже, не связан с основным. Необходимые шаги описаны здесь .

. Другим решением было бы переключиться на JSONQL для языка запросов вместо JSON. Это позволит вам перемещаться вверх по дереву JSON при создании новых экземпляров источника данных с помощью метода subDataSource().

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...