Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6871213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:46:41+00:00 2026-05-27T03:46:41+00:00

I have got sub-reports working, but only the first item in each sub report

  • 0

I have got sub-reports working, but only the first item in each sub report gets displayed over and over again.

So data formatted like this:           Looks like this

    A                                   A
      1                                   1
      2                                   1
      3                                   1
    B                                   B
      4                                   4
      5                                   4
      6                                   4
    C                                   C
      7                                   7 
      8                                   7

The master report template:

<?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="Journey Report" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
    <property name="ireport.zoom" value="1.4641000000000006"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="0"/>
    <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
        <defaultValueExpression><![CDATA["/home/stuart/"]]></defaultValueExpression>
    </parameter>
    <queryString language="xPath">
        <![CDATA[/clsXMLJourneyReport/JourneyList/clsXMLJourney]]>
    </queryString>
    <field name="ID" class="java.lang.String">
        <fieldDescription><![CDATA[ID]]></fieldDescription>
    </field>
    <field name="dateFrom" class="java.lang.String">
        <fieldDescription><![CDATA[dateFrom]]></fieldDescription>
    </field>
    <field name="dateTo" class="java.lang.String">
        <fieldDescription><![CDATA[dateTo]]></fieldDescription>
    </field>
    <field name="locFrom" class="java.lang.String">
        <fieldDescription><![CDATA[locFrom]]></fieldDescription>
    </field>
    <field name="locTo" class="java.lang.String">
        <fieldDescription><![CDATA[locTo]]></fieldDescription>
    </field>
    <field name="distance" class="java.lang.String">
        <fieldDescription><![CDATA[distance]]></fieldDescription>
    </field>
    <field name="journeyTime" class="java.lang.String">
        <fieldDescription><![CDATA[journeyTime]]></fieldDescription>
    </field>
    <field name="aveSpeed" class="java.lang.String">
        <fieldDescription><![CDATA[aveSpeed]]></fieldDescription>
    </field>
    <field name="distanceCF" class="java.lang.String">
        <fieldDescription><![CDATA[distanceCF]]></fieldDescription>
    </field>
    <field name="idleTime" class="java.lang.String">
        <fieldDescription><![CDATA[idleTime]]></fieldDescription>
    </field>
    <field name="Title1" class="java.lang.String">
        <fieldDescription><![CDATA[/clsXMLJourneyReport/Title1]]></fieldDescription>
    </field>
    <field name="Title2" class="java.lang.String">
        <fieldDescription><![CDATA[/clsXMLJourneyReport/Title2]]></fieldDescription>
    </field>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="79" splitType="Stretch">
            <image scaleImage="FillFrame">
                <reportElement x="0" y="0" width="555" height="79"/>
                <imageExpression><![CDATA["/home/stuart/Documents/Logic Ethos/Images/reportBackground1.jpg"]]></imageExpression>
            </image>
            <textField>
                <reportElement x="7" y="27" width="508" height="22"/>
                <textElement>
                    <font size="18"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{Title1}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="7" y="59" width="508" height="20"/>
                <textElement/>
                <textFieldExpression><![CDATA[$F{Title2}]]></textFieldExpression>
            </textField>
        </band>
    </title>
    <pageHeader>
        <band height="25" splitType="Stretch">
            <textField>
                <reportElement x="435" y="5" width="80" height="20"/>
                <textElement textAlignment="Right">
                    <font size="8"/>
                </textElement>
                <textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
            </textField>
            <textField evaluationTime="Report">
                <reportElement x="515" y="5" width="40" height="20"/>
                <textElement>
                    <font size="8"/>
                </textElement>
                <textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
            </textField>
        </band>
    </pageHeader>
    <detail>
        <band height="114" splitType="Stretch">
            <rectangle radius="10">
                <reportElement mode="Opaque" x="0" y="0" width="555" height="43" backcolor="#98E4FF"/>
            </rectangle>
            <textField>
                <reportElement x="134" y="4" width="411" height="10"/>
                <textElement>
                    <font fontName="SansSerif" size="8"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{locFrom}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="134" y="17" width="411" height="11"/>
                <textElement>
                    <font fontName="SansSerif" size="8"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{locTo}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="34" y="4" width="100" height="10"/>
                <textElement>
                    <font fontName="SansSerif" size="8"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{dateFrom}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="34" y="17" width="100" height="11"/>
                <textElement>
                    <font fontName="SansSerif" size="8"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{dateTo}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="7" y="4" width="26" height="10"/>
                <textElement>
                    <font fontName="SansSerif" size="8"/>
                </textElement>
                <text><![CDATA[From:]]></text>
            </staticText>
            <staticText>
                <reportElement x="7" y="17" width="26" height="11"/>
                <textElement>
                        <font fontName="SansSerif" size="8"/>
                </textElement>
                <text><![CDATA[To:]]></text>
            </staticText>
            <subreport>
                <reportElement x="7" y="44" width="538" height="69"/>
                <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("//XMLJourneyItem")]]></dataSourceExpression>
                <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "Journey Report_GPS.jasper"]]></subreportExpression>
            </subreport>
            <textField>
                <reportElement x="488" y="31" width="70" height="15"/>
                <textElement>
                    <font size="8"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{distance}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="443" y="31" width="42" height="15"/>
                <textElement>
                    <font size="8"/>
                </textElement>
                <text><![CDATA[odometer:]]></text>
            </staticText>
            <textField>
                <reportElement x="207" y="31" width="60" height="16"/>
                <textElement>
                    <font size="8"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{idleTime}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="184" y="31" width="23" height="15"/>
                <textElement>
                    <font size="8"/>
                </textElement>
                <text><![CDATA[Idle:]]></text>
            </staticText>
            <textField>
                <reportElement x="414" y="31" width="29" height="20"/>
                <textElement>
                    <font size="8"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{distanceCF}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="379" y="31" width="46" height="20"/>
                <textElement>
                    <font size="8"/>
                </textElement>
                <text><![CDATA[crow-fly:]]></text>
            </staticText>
            <textField>
                <reportElement x="97" y="31" width="100" height="16"/>
                <textElement>
                    <font size="8"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{journeyTime}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="35" y="31" width="62" height="16"/>
                <textElement>
                    <font size="8"/>
                </textElement>
                <text><![CDATA[Journey Time:]]></text>
            </staticText>
            <textField>
                <reportElement x="325" y="31" width="38" height="20"/>
                <textElement>
                    <font size="8"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{aveSpeed}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="276" y="31" width="54" height="12"/>
                <textElement>
                    <font size="8"/>
                </textElement>
                <text><![CDATA[Ave Speed:]]></text>
            </staticText>
        </band>
    </detail>
    <pageFooter>
        <band height="54" splitType="Stretch"/>
    </pageFooter>
    <summary>
        <band height="42" splitType="Stretch"/>
    </summary>
</jasperReport>

The subreport template:

<?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="Journey Report_GPS" language="groovy" pageWidth="555" pageHeight="802" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
    <property name="ireport.zoom" value="1.3310000000000004"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="0"/>
    <queryString language="xPath">
        <![CDATA[/clsXMLJourneyReport/JourneyList/clsXMLJourney/JourneyItems/XMLJourneyItem]]>
    </queryString>
    <field name="date" class="java.lang.String">
        <fieldDescription><![CDATA[/clsXMLJourney/JourneyItems/XMLJourneyItem/date]]></fieldDescription>
    </field>
    <field name="status" class="java.lang.String">
        <fieldDescription><![CDATA[/clsXMLJourney/JourneyItems/XMLJourneyItem/status]]></fieldDescription>
    </field>
    <field name="odo" class="java.lang.String">
        <fieldDescription><![CDATA[/clsXMLJourney/JourneyItems/XMLJourneyItem/odo]]></fieldDescription>
    </field>
    <field name="loc" class="java.lang.String">
        <fieldDescription><![CDATA[/clsXMLJourney/JourneyItems/XMLJourneyItem/loc]]></fieldDescription>
    </field>
    <background>
        <band splitType="Stretch"/>
    </background>
    <columnHeader>
        <band height="28" splitType="Stretch">
            <staticText>
                <reportElement x="2" y="15" width="100" height="12"/>
                <textElement>
                    <font fontName="Ubuntu" size="8"/>
                </textElement>
                <text><![CDATA[Time]]></text>
            </staticText>
            <staticText>
                <reportElement x="102" y="15" width="100" height="12"/>
                <textElement>
                    <font fontName="Ubuntu" size="8"/>
                </textElement>
                <text><![CDATA[Location]]></text>
            </staticText>
            <staticText>
                <reportElement x="376" y="16" width="100" height="12"/>
                <textElement>
                    <font fontName="Ubuntu" size="8"/>
                </textElement>
                <text><![CDATA[Status]]></text>
            </staticText>
            <staticText>
                <reportElement x="476" y="16" width="100" height="12"/>
                <textElement>
                    <font fontName="Ubuntu" size="8"/>
                </textElement>
                <text><![CDATA[Odometer]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="16" splitType="Stretch">
            <textField>
                <reportElement x="2" y="4" width="100" height="12"/>
                <textElement>
                    <font fontName="Ubuntu" size="8"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{date}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="102" y="4" width="274" height="12"/>
                <textElement>
                    <font fontName="Ubuntu" size="8"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{loc}]]></textFieldExpression>
            </textField>
            <textField isBlankWhenNull="true">
                <reportElement x="376" y="4" width="100" height="12"/>
                <textElement>
                    <font fontName="Ubuntu" size="8"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{status}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="476" y="4" width="100" height="12"/>
                <textElement>
                    <font fontName="Ubuntu" size="8"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{odo}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
</jasperReport>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:46:41+00:00Added an answer on May 27, 2026 at 3:46 am

    If the input xml data looks like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <clsXMLJourneyReport>
        <Title1>Title</Title1>
        <Title2>Long title</Title2>
        <JourneyList>
            <clsXMLJourney>
                <ID>100</ID>
                <dateFrom>20.10.2010</dateFrom>
                <dateTo>20.12.2010</dateTo>
                <locFrom>21.11.2010</locFrom>
                <locTo>29.11.2010</locTo>
                <distance>122</distance>
                <journeyTime>27.11.2010</journeyTime>
                <aveSpeed>350</aveSpeed>
                <distanceCF>110</distanceCF>
                <idleTime>20.03.2011</idleTime>
                <JourneyItems>
                    <XMLJourneyItem>
                        <date>21.03.2011</date>
                        <status>NEW</status>
                        <odo>odo1</odo>
                        <loc>loc1</loc>
                    </XMLJourneyItem>
                    <XMLJourneyItem>
                        <date>22.03.2011</date>
                        <status>NEW</status>
                        <odo>odo2</odo>
                        <loc>loc2</loc>
                    </XMLJourneyItem>
                    <XMLJourneyItem>
                        <date>23.03.2011</date>
                        <status>COORD</status>
                        <odo>odo3</odo>
                        <loc>loc3</loc>
                    </XMLJourneyItem>
                </JourneyItems>
            </clsXMLJourney>
            <clsXMLJourney>
                <ID>200</ID>
                <dateFrom>18.09.2010</dateFrom>
                <dateTo>25.09.2010</dateTo>
                <locFrom>15.09.2010</locFrom>
                <locTo>17.09.2010</locTo>
                <distance>300</distance>
                <journeyTime>10.09.2010</journeyTime>
                <aveSpeed>330</aveSpeed>
                <distanceCF>120</distanceCF>
                <idleTime>25.03.2011</idleTime>
                <JourneyItems>
                    <XMLJourneyItem>
                        <date>25.03.2011</date>
                        <status>NEW</status>
                        <odo>odo2_1</odo>
                        <loc>loc2_1</loc>
                    </XMLJourneyItem>
                    <XMLJourneyItem>
                        <date>25.03.2011</date>
                        <status>SIGN</status>
                        <odo>odo2_2</odo>
                        <loc>loc2_2</loc>
                    </XMLJourneyItem>
                </JourneyItems>
            </clsXMLJourney>
        </JourneyList>
    </clsXMLJourneyReport>
    

    You can make this edits in your subreport:

    <queryString language="xPath">
        <![CDATA[*]]>
    </queryString>
    <field name="date" class="java.lang.String">
        <fieldDescription><![CDATA[date]]></fieldDescription>
    </field>
    <field name="status" class="java.lang.String">
        <fieldDescription><![CDATA[status]]></fieldDescription>
    </field>
    <field name="odo" class="java.lang.String">
        <fieldDescription><![CDATA[odo]]></fieldDescription>
    </field>
    <field name="loc" class="java.lang.String">
        <fieldDescription><![CDATA[loc]]></fieldDescription>
    </field>
    

    The result will be:

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a main report, with a space for a sub report. Depending on
I have three row in jasper sub report , I face problem when I
I have got a problem and a solution, but I am not really satisfied
I have got a native join sub query problem in MySQL Entity. SQL code
I have got below code in VBScript. Sub SetPageLocale() Dim Locale Dim ContextObject Set
I have got lots of ideas from google and stackoverflow- but none of those
Have got an NSString *str = @12345.6789 and want to find out if there
We have got a custom MembershipProvider in ASP.NET . Now there are 2 possible
We have got loads of options for php + MySQL + Apache combo... Which
I have got a python script which is creating an ODBC connection. The ODBC

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.