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

baffled

Members
  • Posts

    8
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Posts posted by baffled

  1. Hi,

     

    I'm not sure if you want each subreport on a different page, or each row on your subreport on a different page.

     

    Either way you can use the 'break' object from the palette.

     

    If you want each row of your subreport on a different page - drag the 'break' from the palette onto your detail band and place it below your row of data.

     

    You need to deal with this on the subreport - not on the master report.

     

    If you have two subreports and you want the second subreport to start on a new page, place the break between the two subreports that are on your master report.

     

    HTH

     

     

  2. 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
×
×
  • Create New...