2001 JI Open Discussion Posted August 17, 2006 Share Posted August 17, 2006 By: Harold Bolsover - hbolsover Only displaying last element from datasource 2002-12-16 11:26Hi, I'm trying to follow the example app webapps. I've made a datasource class. The JasperFillManager.fillReport() methods enters the datasource next() method once for each element in the source data, but it only enters the getFieldValue() method after the last next() method call, where it finds the proper data for the last element. I'm guessing there is something wrong with the report definition (see below). I've purchase and read your manual, I don't see what I'm missing. Any suggestions? <?xml version="1.0"?> <!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"> <jasperReport name="GLAccountList" pageWidth="612" pageHeight="792" columnWidth="532" columnSpacing="0" leftMargin="40" rightMargin="40" topMargin="50" bottomMargin="50"> <reportFont name="Arial_Normal" isDefault="true" fontName="Arial" size="12" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/> <reportFont name="Arial_Bold" isDefault="false" fontName="Arial" size="12" isBold="true" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/> <reportFont name="Arial_Italic" isDefault="false" fontName="Arial" size="12" isItalic="true" pdfFontName="Helvetica-Oblique" pdfEncoding="Cp1252" isPdfEmbedded="false"/> <parameter name="ReportTitle" class="java.lang.String"/> <parameter name="BaseDir" class="java.io.File"/> <field name="accountNumber" class="java.lang.String"/> <field name="accountName" class="java.lang.String"/> <field name="accountType" class="java.lang.String"/> <field name="accountStatus" class="java.lang.String"/> <title> <band height="50"> <textField isBlankWhenNull="true"> <reportElement x="170" y="10" width="345" height="30"/> <textElement textAlignment="Center" lineSpacing="Single"> <font reportFont="Arial_Normal" size="22"/> </textElement> <textFieldExpression class="java.lang.String">$P{ReportTitle}</textFieldExpression> </textField> </band> </title> <pageHeader> <band height="20"> <staticText> <reportElement x="0" y="5" width="55" height="15" forecolor="#FFFFFF" backcolor="#333333" mode="Opaque"/> <textElement textAlignment="Center"> <font reportFont="Arial_Bold"/> </textElement> <text>Account</text> </staticText> <staticText> <reportElement x="55" y="5" width="205" height="15" forecolor="#FFFFFF" backcolor="#333333" mode="Opaque"/> <textElement> <font reportFont="Arial_Bold"/> </textElement> <text>Name</text> </staticText> <staticText> <reportElement x="260" y="5" width="100" height="15" forecolor="#FFFFFF" backcolor="#333333" mode="Opaque"/> <textElement> <font reportFont="Arial_Bold"/> </textElement> <text>Type</text> </staticText> <staticText> <reportElement x="360" y="5" width="100" height="15" forecolor="#FFFFFF" backcolor="#333333" mode="Opaque"/> <textElement> <font reportFont="Arial_Bold"/> </textElement> <text>Status</text> </staticText> </band> </pageHeader> <detail> <band height="20"> <textField> <reportElement x="0" y="5" width="50" height="15"/> <textElement textAlignment="Right"/> <textFieldExpression class="java.lang.String"> $F{accountNumber} </textFieldExpression> </textField> <textField isStretchWithOverflow="true"> <reportElement x="55" y="5" width="200" height="15" positionType="Float"/> <textFieldExpression class="java.lang.String"> $F{accountName} </textFieldExpression> </textField> <textField isStretchWithOverflow="true"> <reportElement x="260" y="5" width="100" height="15" positionType="Float"/> <textFieldExpression class="java.lang.String"> $F{accountType} </textFieldExpression> </textField> <textField isStretchWithOverflow="true"> <reportElement x="360" y="5" width="100" height="15" positionType="Float"/> <textFieldExpression class="java.lang.String"> $F{accountStatus} </textFieldExpression> </textField> </band> </detail> <pageFooter> <band height="40"> <textField> <reportElement x="200" y="20" width="80" height="15"/> <textElement textAlignment="Right"/> <textFieldExpression class="java.lang.String"> "Page " + String.valueOf($V{PAGE_NUMBER}) + " of" </textFieldExpression> </textField> <textField evaluationTime="Report"> <reportElement x="284" y="20" width="75" height="15"/> <textElement textAlignment="Left"/> <textFieldExpression class="java.lang.String"> " " + String.valueOf($V{PAGE_NUMBER}) </textFieldExpression> </textField> </band> </pageFooter> <summary> <band height="80"> <textField isStretchWithOverflow="true"> <reportElement x="175" y="20" width="165" height="15"/> <textElement textAlignment="Center"> <font reportFont="Arial_Italic"/> </textElement> <textFieldExpression class="java.lang.String"> "There were " + String.valueOf($V{REPORT_COUNT}) + " Accounts on this report. " </textFieldExpression> </textField> </band> </summary> </jasperReport> Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now