0

I m using tibco jaspersoft studio to generate a report

droping fields in the detail band is getting all data but when I try to use a table I m getting two empty pages.

the printing option is set to print all sections no details

here is my data json file

[ {
    "clientName" : "SEMMOUD Abderrazak",
    "clientPhone" : "043303854",
    "codeExterne" : "CLI201801",
    "email" : "[email protected]",
    "clientType" : 0,
    "clientEtat" : 1,
    "identifiant" : "TalcorpDZ",
    "contacts" : [ {
        "nom" : "Taleb",
        "prenom" : "Mohammed Housseyn",
        "telephonePortable" : "04330256699",
        "email" : null
    } ],
    "adresses" : [ {
        "adress" : "Batiments des enseignants Mohammed Khemisti",
        "ville" : "Maghnia"
    } ]
}, {
    "clientName" : "",
    "clientPhone" : "",
    "codeExterne" : "sdsqdqs",
    "email" : "[email protected]",
    "clientType" : 1,
    "clientEtat" : 1,
    "identifiant" : "sqdsqd",
    "contacts" : [ {
        "nom" : "Taleb",
        "prenom" : "Mohammed",
        "telephonePortable" : "+213778217469",
        "email" : null
    } ],
    "adresses" : [ {
        "adress" : "Batiments des enseignants ",
        "ville" : "Maghnia"
    } ]
} ]

and here is my report

<?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="refClient" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" whenResourceMissingType="Empty" uuid="758785c8-ae8f-49bd-9995-19c9827a7ebb">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="refcliJsonAdapter"/>
    <subDataset name="jsonRefClient" whenResourceMissingType="Empty" uuid="1dcb37f4-96e4-472a-aadb-309de9d05089">
        <property name="com.jaspersoft.studio.data.defaultdataadapter" value="refcliJsonAdapter"/>
        <queryString language="json">
            <![CDATA[]]>
        </queryString>
        <field name="clientName" class="java.lang.String">
            <property name="net.sf.jasperreports.json.field.expression" value="clientName"/>
            <fieldDescription><![CDATA[clientName]]></fieldDescription>
        </field>
    </subDataset>
    <queryString language="JSON">
        <![CDATA[]]>
    </queryString>
    <field name="clientName" class="java.lang.String">
        <property name="net.sf.jasperreports.json.field.expression" value="clientName"/>
        <fieldDescription><![CDATA[clientName]]></fieldDescription>
    </field>
    <detail>
        <band height="258" splitType="Stretch">
            <componentElement>
                <reportElement x="40" y="10" width="660" height="200" uuid="a43c33cc-e3f9-470c-8df4-1c36301c869e">
                    <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
                    <property name="com.jaspersoft.studio.components.autoresize.proportional" value="true"/>
                    <property name="com.jaspersoft.studio.components.autoresize.next" value="true"/>
                </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="jsonRefClient" uuid="b4a19c4b-0cb1-481a-a9ba-739ce437135a">
                        <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                    </datasetRun>
                    <jr:column width="660" uuid="eda57584-75da-466c-8182-d466356f3cc4">
                        <jr:tableHeader height="30" rowSpan="1"/>
                        <jr:tableFooter height="30" rowSpan="1"/>
                        <jr:columnHeader height="30" rowSpan="1">
                            <staticText>
                                <reportElement x="0" y="0" width="660" height="30" uuid="d349739f-3e3d-4012-8e52-3b5c7bd75eb9"/>
                                <text><![CDATA[clientName]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter height="30" rowSpan="1"/>
                        <jr:detailCell height="30">
                            <textField>
                                <reportElement x="0" y="0" width="660" height="30" uuid="fb6bb53f-e520-48f4-81e0-189ae5058656"/>
                                <textFieldExpression><![CDATA[$F{clientName}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                </jr:table>
            </componentElement>
        </band>
    </detail>
</jasperReport>

What should I do to fix this issue?

2
  • @Alex K, you have not properly edited the report JRXML and it is now in an uncompilable state. Commented Nov 15, 2018 at 20:32
  • It is a problem, indeed, with huge templates and unnecessary code. Most people don't even bother reading the mcve. But I find it hard, sometimes, to cleanup a report from within JSS, so I do it manually instead. And I don't think that's easy for everyone. Commented Nov 16, 2018 at 8:24

1 Answer 1

2

Your table dataSet is not actually linked to any data, at runtime. A quick fix is to:

  1. Export your JSON Data Adapter to a file on the same level as your report, let's say refcliJsonAdapter.xml
  2. Add the net.sf.jasperreports.data.adapter property to your table dataSet, something like:

    <subDataset name="jsonRefClient" whenResourceMissingType="Empty" uuid="1dcb37f4-96e4-472a-aadb-309de9d05089">
        ...
        <property name="net.sf.jasperreports.data.adapter" value="refcliJsonAdapter.xml"/>
        ...
    </subDataset>
    
  3. Preview the report against the One Empty Record built-in Data Adapter if you don't want repeating tables.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.