Jump to content
Changes to the Jaspersoft community edition download ×

unable to compile master report - pls advise


baffled

Recommended Posts

I am trying to set up a master report with two subreports that I plan to intergrate with Spring.

I need some help because I'm having a problem compiling the master report. I'm defining the locations of the subreports as parameters in the master report - as per the Spring documentation - but iReport is not able to find the subreports using the parameters.

This is my error in iReport:

Compiling to file... c:someFolderMR_S_master.jasper  

Compiling subreports....  Unable to locate the subreport with expression: "$P{MR_S1_SUBREPORT}".

This is the jrxml of the 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="MR_S_Master" pageWidth="595" pageHeight="842" columnWidth="535" 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="MR_S1_SUBREPORT" class="net.sf.jasperreports.engine.JasperReport"/>
 <parameter name="MR_S2_SUBREPORT" class="net.sf.jasperreports.engine.JasperReport"/>
 <parameter name="MR_S1_DATA" class="java.util.Collection"/>
 <parameter name="MR_S2_DATA" class="java.util.Collection"/>
 <queryString>
  <![CDATA[]]>
 </queryString>
 <background>
  <band/>
 </background>
 <pageHeader>
  <band height="21">
   <staticText>
    <reportElement x="0" y="0" width="555" height="20"/>
    <textElement textAlignment="Center">
     <font size="14" isBold="true"/>
    </textElement>
    <text><![CDATA[Report Title]]></text>
   </staticText>
  </band>
 </pageHeader>
 <detail>
  <band height="32">
   <subreport>
    <reportElement x="0" y="0" width="555" height="1"/>
    <parametersMapExpression><![CDATA[$P{REPORT_PARAMETERS_MAP}]]></parametersMapExpression>
    <dataSourceExpression><![CDATA[$P{MR_S1_DATA}]]></dataSourceExpression>
    <subreportExpression class="net.sf.jasperreports.engine.JasperReport"><![CDATA[$P{MR_S1_SUBREPORT}]]></subreportExpression>
   </subreport>
   <break>
    <reportElement x="0" y="4" width="555" height="1"/>
   </break>
   <subreport>
    <reportElement positionType="Float" x="0" y="9" width="555" height="1"/>
    <parametersMapExpression><![CDATA[$P{REPORT_PARAMETERS_MAP}]]></parametersMapExpression>
    <dataSourceExpression><![CDATA[$P{MR_S2_DATA}]]></dataSourceExpression>
    <subreportExpression class="net.sf.jasperreports.engine.JasperReport"><![CDATA[$P{MR_S2_SUBREPORT}]]></subreportExpression>
   </subreport>
  </band>
 </detail>
 <columnFooter>
  <band/>
 </columnFooter>
 <pageFooter>
  <band height="17">
  </band>
 </pageFooter>
 <summary>
  <band/>
 </summary>
</jasperReport>


The Spring side will look like this:


<bean id="MR_S_ViewPdf" class="org.springframework.web.servlet.view.jasperreports.JasperReportsPdfView">

<property name="url">
 <value>classpath:/someFolder/MR_S_master.jrxml</value>
</property>

<property name="subReportUrls">
 <map>
    <entry key="MR_S1_SUBREPORT" value="classpath:/someFolder/MR_S1_subreport.jasper"/>
   <entry key="MR_S2_SUBREPORT" value="classpath:/someFolder/MR_S2_subreport.jasper"/>
 </map>
</property>

<property name="subReportDataKeys">
 <list>
  <value>MR_S1_DATA</value>
  <value>MR_S2_DATA</value>
 </list>
</property>

<property name="reportDataKey">
 <value>MR_S_DATA</value>
</property>

</bean>



Post Edited by baffled at 08/10/2010 03:51
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • 3 years later...

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...