I have seen quite a few questions on blank subreports but none of them provide the information I need. I have a master 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="sample_report" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="reportTitle" class="java.lang.String"/>
<parameter name="reportSubTitle" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="65" splitType="Stretch">
<textField>
<reportElement x="0" y="0" width="555" height="20"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$P{reportTitle}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="434" y="40" width="80" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="514" y="40" width="40" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="20" width="555" height="20"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$P{reportSubTitle}]]></textFieldExpression>
</textField>
</band>
</title>
<pageHeader>
<band splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band splitType="Stretch"/>
</columnHeader>
<detail>
<band height="109" splitType="Stretch">
<subreport isUsingCache="false">
<reportElement x="0" y="0" width="555" height="100" isPrintWhenDetailOverflows="true"/>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA["sample_report_activity_report.jasper"]]></subreportExpression>
</subreport>
</band>
</detail>
<columnFooter>
<band splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band splitType="Stretch"/>
</pageFooter>
<summary>
<band splitType="Stretch"/>
</summary>
</jasperReport>
And a subreport:
<?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="sample_report_activity_report" pageWidth="802" pageHeight="555" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="802" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<queryString language="SQL">
<![CDATA[SELECT ActivityType, Count, Amount, ActivityDate FROM Activity WHERE ARIID = 1]]>
</queryString>
<field name="ActivityType" class="java.lang.String"/>
<field name="Count" class="java.lang.String"/>
<field name="Amount" class="java.lang.String"/>
<field name="ActivityDate" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="24" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="802" height="20"/>
<textElement textAlignment="Center"/>
<text><![CDATA[Activity Report]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="25" splitType="Stretch">
<staticText>
<reportElement x="12" y="0" width="100" height="20"/>
<textElement/>
<text><![CDATA[ActivityType]]></text>
</staticText>
<staticText>
<reportElement x="112" y="0" width="100" height="20"/>
<textElement/>
<text><![CDATA[Count]]></text>
</staticText>
<staticText>
<reportElement x="215" y="0" width="100" height="20"/>
<textElement/>
<text><![CDATA[Amount]]></text>
</staticText>
<staticText>
<reportElement x="315" y="0" width="100" height="20"/>
<textElement/>
<text><![CDATA[ActivityDate]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="22" splitType="Stretch">
<textField>
<reportElement x="12" y="0" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{ActivityType}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="115" y="0" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{Count}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="215" y="0" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{Amount}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="315" y="2" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{ActivityDate}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="802" height="20"/>
<textElement textAlignment="Center"/>
<text><![CDATA[--- End of Activity Report ---]]></text>
</staticText>
</band>
</summary>
</jasperReport>
And I have the following Java code:
Map parameters = new HashMap();
parameters.put("reportTitle", "Report");
parameters.put("reportSubTitle", "Activity Date 10/25/2011");
JasperReport jasperReportMain = JasperCompileManager.compileReport("c:\\tempfilepath\\sample_report.jrxml");
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReportMain, parameters, con);
JasperExportManager.exportReportToPdfFile(jasperPrint, "c:\\tempfilepath\\SampleReport.pdf");
As far as I can tell I have followed all the previous advice given and I still don't have any data showing up in my subreport when I run the main report. What am I doing wrong?