Jump to content
We've recently updated our Privacy Statement, available here ×

Help,SubReport only displays the first record


Recommended Posts

By: Dennis - dogcat

Help,SubReport only displays the first record

2006-01-19 18:08

Greeting group.

 

I am using master - detail pattern. My Jasper Report version is 0.6.0.

 

I put my data for sub report into a JRMapArrayDataSource and pass it to subreport, but the sub report only displays the firs record in my datasource.

 

By the way, is <groupExpression> used to sort the data?

For instance, the data in JRMapArrayDataSource are:

Id col1 col2 col3 col4

A, 1, 2, 3, 4

A, 2, 4, 5, 7

B, 1 3 4 4

 

Can I use $P{Id} to make it into two groups? I passed in the id from main report. Basically I want to display it as:

Header( A )

1, 2,3, 4

2, 4, 5,7

Header( B )

2, 3 3,3

 

The following are my xml files. Would you please tell me what's wrong with my templates? or is this a bug?

 

Thanks,

 

 

My xml files:

Master:

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE jasperReport SYSTEM "reportjasperreport.dtd">

 

<jasperReport name="DetailReport" columnCount="1" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="842" columnSpacing="0" leftMargin="0" rightMargin="0" topMargin="36" bottomMargin="36">

<parameter name="USER_ID" class="java.lang.String" isForPrompting="false">

<parameterDescription><![CDATA[user Name]]></parameterDescription>

<defaultValueExpression>"User"</defaultValueExpression>

</parameter>

<parameter name="COMPANY_NAME" class="java.lang.String" isForPrompting="false">

<parameterDescription><![CDATA[Company's name]]></parameterDescription>

<defaultValueExpression>"Epic data"</defaultValueExpression>

</parameter>

<parameter name="DATE" class="java.util.Date" isForPrompting="false">

<parameterDescription><![CDATA[date from server]]></parameterDescription>

<defaultValueExpression>new java.util.Date()</defaultValueExpression>

</parameter>

<parameter name="FILTER" class="java.lang.String" isForPrompting="false">

<parameterDescription><![CDATA[The filter for inquiry screen]]></parameterDescription>

<defaultValueExpression>""</defaultValueExpression>

</parameter>

<parameter name="ORIGINALORCOPY" class="java.lang.String" isForPrompting="false">

<parameterDescription><![CDATA[Original or copy]]></parameterDescription>

<defaultValueExpression>"Original"</defaultValueExpression>

</parameter>

<parameter name="REPORT_ID" class="java.lang.String">

<parameterDescription><![CDATA[Report Id]]></parameterDescription>

<defaultValueExpression>"000"</defaultValueExpression>

</parameter>

<parameter name="REPORT_NAME" class="java.lang.String">

<parameterDescription><![CDATA[The name]]></parameterDescription>

<defaultValueExpression>"Inquiry Result Report"</defaultValueExpression>

</parameter>

<parameter name="PRODUCT_SUBREPORT" class="net.sf.jasperreports.engine.JasperReport">

</parameter>

<parameter name="SUB_REPORT_DATA" class="net.sf.jasperreports.engine.data.JRMapArrayDataSource">

</parameter>

<field class="java.lang.String" name="SUMMARYINFO"/>

<title>

<band height="0">

</band>

</title>

<pageHeader>

<band height="0">

</band>

</pageHeader>

 

<detail>

<band height="40">

<textField>

<reportElement positionType="Float" mode="Opaque" x="34" y="1" width="700" height="17" />

<textElement>

<font fontName="SansSerif" size="12" pdfFontName="Helvetica" pdfEncoding="CP1252" isPdfEmbedded="false" />

</textElement>

<textFieldExpression class="java.lang.String">$F{SUMMARYINFO}</textFieldExpression>

</textField>

<line>

<reportElement x="30" y="22" width="650" height="2"/>

<graphicElement/>

</line>

<subreport>

<reportElement isPrintRepeatedValues="false" x="34" y="1" width="700" height="20" isRemoveLineWhenBlank="true"/>

<subreportParameter name="SUMMARYINFO">

<subreportParameterExpression><![CDATA[$F{SUMMARYINFO}]]></subreportParameterExpression>

</subreportParameter>

<dataSourceExpression>

<![CDATA[$P{SUB_REPORT_DATA}]]>

</dataSourceExpression>

<subreportExpression class="net.sf.jasperreports.engine.JasperReport"><![CDATA[$P{PRODUCT_SUBREPORT}]]></subreportExpression>

</subreport>

</band>

</detail>

<pageFooter>

<band height="20">

<textField>

<reportElement x="100" y="4" width="80" height="15"/>

<textElement textAlignment="Right"/>

<textFieldExpression class="java.lang.String"><![CDATA["Page " + String.valueOf($V{PAGE_NUMBER}) + " of"]]></textFieldExpression>

</textField>

<textField evaluationTime="Report">

<reportElement x="180" y="4" width="80" height="15"/>

<textElement/>

<textFieldExpression class="java.lang.String"><![CDATA[" " + String.valueOf($V{PAGE_NUMBER})]]></textFieldExpression>

</textField>

</band>

</pageFooter>

</jasperReport>

 

 

Detail:

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE jasperReport SYSTEM "reportjasperreport.dtd">

 

<jasperReport name="DetailSubReport" columnCount="1" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="842" columnSpacing="0" leftMargin="0" rightMargin="0" topMargin="36" bottomMargin="36">

<parameter name="SUMMARYINFO" class="java.lang.String">

</parameter>

<field class="java.lang.String" name="beginningData"/>

 

<group name="DetailGroup">

<groupExpression><![CDATA[$P{SUMMARYINFO}]]></groupExpression>

<groupHeader>

<band height="20">

<textField>

<reportElement positionType="Float" mode="Opaque" x="34" y="1" width="109" height="17" />

<textElement>

<font fontName="SansSerif" size="12" pdfFontName="Helvetica" pdfEncoding="CP1252" isPdfEmbedded="false" />

</textElement>

<textFieldExpression class="java.lang.String">$F{beginningData}</textFieldExpression>

</textField>

</band>

</groupHeader>

<groupFooter>

<band>

</band>

</groupFooter>

</group>

<title>

<band height="0">

<!--

<textField>

<reportElement positionType="Float" mode="Opaque" x="34" y="1" width="500" height="17" />

<textElement>

<font fontName="SansSerif" size="12" pdfFontName="Helvetica" pdfEncoding="CP1252" isPdfEmbedded="false" />

</textElement>

<textFieldExpression class="java.lang.String">$P{SUMMARYINFO}</textFieldExpression>

</textField>

-->

</band>

</title>

<columnHeader>

<band height="24">

<staticText>

<reportElement mode="Opaque" x="34" y="5" width="109" height="19" />

<textElement>

<font fontName="SansSerif" size="12" isBold="true" pdfFontName="Helvetica" pdfEncoding="CP1252" isPdfEmbedded="false" />

</textElement>

<text>BeginningColumn</text>

</staticText>

<line>

<reportElement x="30" y="22" width="650" height="1"/>

<graphicElement/>

</line>

</band>

</columnHeader>

<detail>

<band height="0" isSplitAllowed="true">

</band>

</detail>

<pageFooter>

<band height="0">

</band>

</pageFooter>

</jasperReport>

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...