2002 JI Open Discussion Posted August 18, 2006 Share Posted August 18, 2006 By: Allen Pham - apham Subreport not displaying results 2003-04-17 14:00 Hello, I have a problem I can seem to resovle. I have scanned the forum and tried different methods but still not getting the desired results. Basically, I have a master and subreport. When running the report, the subreport content shows up nothing. Below is the report I'm attempting to run. Anyone have any ideas what I'm doing wrong. SalesSummary.xml <?xml version="1.0" encoding="UTF-8" ?> <!-- Created with iReport - A designer for JasperReports --> <!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"> <jasperReport name="SalesSummary" columnCount="1" printOrder="Vertical" orientation="Portrait" pageWidth="612" pageHeight="792" columnWidth="535" columnSpacing="0" leftMargin="30" rightMargin="30" topMargin="20" bottomMargin="20" whenNoDataType="AllSectionsNoDetail" isTitleNewPage="false" isSummaryNewPage="false"> <title> <band height="49"> <staticText> <reportElement mode="Transparent" x="0" y="20" width="552" height="25" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Center" verticalAlignment="Middle" lineSpacing="Single"> <font fontName="" pdfFontName="Helvetica-Bold" size="12" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <text>DAILY BALANCE REPORT</text> </staticText> <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Report" hyperlinkType="None" > <reportElement mode="Transparent" x="390" y="3" width="160" height="15" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Right" verticalAlignment="Middle" lineSpacing="Single"> <font fontName="" pdfFontName="Helvetica" size="9" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.util.Date"><![CDATA[new java.util.Date()]]></textFieldExpression> </textField> </band> </title> <pageHeader> <band height="0"> </band> </pageHeader> <columnHeader> <band height="0"> </band> </columnHeader> <detail> <band height="123"> <staticText> <reportElement mode="Transparent" x="6" y="5" width="264" height="18" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Center" verticalAlignment="Middle" lineSpacing="Single"> <font fontName="" pdfFontName="Helvetica" size="12" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <text>Sale Summary</text> </staticText> <staticText> <reportElement mode="Transparent" x="6" y="50" width="80" height="10" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <text>Voids</text> </staticText> <subreport isUsingCache="true"> <reportElement mode="Opaque" x="0" y="30" width="284" height="79" forecolor="#000000" backcolor="#FFFFFF" positionType="Float" isPrintRepeatedValues="true" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <dataSourceExpression>$P{REPORT_DATA_SOURCE}</dataSourceExpression> <subreportExpression class="java.lang.String"><![CDATA["GrossSale.jasper"]]></subreportExpression> </subreport> </band> </detail> <columnFooter> <band height="0"> </band> </columnFooter> <pageFooter> <band height="0"> </band> </pageFooter> <summary> <band height="0"> </band> </summary> </jasperReport> SalesSummary.xml <?xml version="1.0" encoding="UTF-8" ?> <!-- Created with iReport - A designer for JasperReports --> <!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"> <jasperReport name="GrossSale" columnCount="1" printOrder="Horizontal" orientation="Portrait" pageWidth="276" pageHeight="25" columnWidth="276" columnSpacing="0" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" whenNoDataType="AllSectionsNoDetail" isTitleNewPage="false" isSummaryNewPage="false"> <queryString><![CDATA[sELECT SUM(BASE_PRICE * QUANTITY) GROSS_AMOUNT FROM EOD_SALE_ITEM]]></queryString> <field name="GROSS_AMOUNT" class="java.lang.Double"/> <title> <band height="0"> </band> </title> <pageHeader> <band height="0"> </band> </pageHeader> <columnHeader> <band height="0"> </band> </columnHeader> <detail> <band height="25"> <staticText> <reportElement mode="Transparent" x="10" y="5" width="80" height="15" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Middle" lineSpacing="Single"> <font fontName="" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <text>Gross Amount</text> </staticText> <textField isStretchWithOverflow="false" pattern="$###,###.00" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement mode="Opaque" x="151" y="5" width="120" height="15" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.Double">$F{GROSS_AMOUNT}</textFieldExpression> </textField> </band> </detail> <columnFooter> <band height="0"> </band> </columnFooter> <pageFooter> <band height="0"> </band> </pageFooter> <summary> <band height="0"> </band> </summary> </jasperReport> Java JasperPrint jasperPrint = JasperManager.fillReport("SalesSummary.jasper", param, DBUtils.getConnection()); ReportViewer.viewReport(jasperPrint); By: mike w - mwans RE: Subreport not displaying results 2003-04-17 14:46 You may want to try putting ConnectionExpression in the subreport section. <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression> The above line worked for me. I had this same problem this morning. In my report I placed it above the <subreportExpression> tags. By: mike w - mwans RE: Subreport not displaying results 2003-04-17 15:12 You may want to try putting ConnectionExpression in the subreport section. <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression> The above line worked for me. I had this same problem this morning. In my report I placed it above the <subreportExpression> tags. 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