pdenno888 Posted July 8, 2015 Posted July 8, 2015 I have an object graph with nested lists that I use to generate a report. This report is modelled as a series of nested subreports with each level having some static text to display.The structure is like this:-- summary_view contains static text and a link to summary_sites (the subreport is passed the list of sites)-- summary_site contains static text and a link to summary_team (the subreport is passed the list of teams for the site)-- summary_team contains static text and a link to summary_turbine (the subreport is passed a list of turbines that each team is working on).-- summary_turbine contains static text and a link to summary_wo (the subreport is passed a list of scheduledWO's for each turbine that is being worked on).The problem is that each subreport is rendered on a new page (even though there is plenty of space available).I am using iReport 3.7.2For example:On the first page Jasper renders:Site: WH1-G1Then on the next page it renders:Crew: S.BRA & G.CLAand then on the next page it renders:Turbine: T110This is not what I want, instead what I want is to have the site, crew(s) and turbine(s) displayed on the same page and then the next iteration to display on a new page, etc.. until all sites have been displayed.Any help in getting the report format corrected would be greatly appreciated.Below is the XML for the summary_view report (i.e. 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="summary_view" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" whenResourceMissingType="Empty"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="0"/> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/> <style name="table_TH" isDefault="false" mode="Opaque" backcolor="#F0F8FF" lineSpacing="Single"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="table_CH" isDefault="false" mode="Opaque" backcolor="#BFE1FF" lineSpacing="Single"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <style name="table_TD" isDefault="false" mode="Opaque" backcolor="#FFFFFF" lineSpacing="Single"> <box> <pen lineWidth="0.5" lineColor="#000000"/> <topPen lineWidth="0.5" lineColor="#000000"/> <leftPen lineWidth="0.5" lineColor="#000000"/> <bottomPen lineWidth="0.5" lineColor="#000000"/> <rightPen lineWidth="0.5" lineColor="#000000"/> </box> </style> <subDataset name="AggregationDataset"> <field name="categoryName" class="java.lang.String"/> <field name="categoryValue" class="java.lang.String"/> </subDataset> <parameter name="STI_SI_RESOURCES_JASPER_DIR" class="java.lang.String"/> <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false"> <defaultValueExpression><![CDATA[$P{STI_SI_RESOURCES_JASPER_DIR} + "/"]]></defaultValueExpression> </parameter> <field name="clusterName" class="java.lang.String"/> <field name="scheduledDate" class="java.lang.String"/> <field name="weatherWarnings" class="java.lang.String"/> <field name="sitesList" class="java.util.List"/> <field name="categoryList" class="java.util.List"/> <field name="totalCrew" class="java.lang.Integer"/> <field name="totalWOs" class="java.lang.Integer"/> <field name="personsByHrs" class="java.lang.String"/> <background> <band splitType="Prevent"/> </background> <detail> <band height="699" splitType="Prevent"> <staticText> <reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="24" width="533" height="35"/> <textElement lineSpacing="Single"> <font size="24" isBold="true"/> </textElement> <text><![CDATA[summary Report]]></text> </staticText> <staticText> <reportElement positionType="Float" x="0" y="71" width="184" height="20"/> <textElement lineSpacing="Single"> <font size="12" isBold="true"/> </textElement> <text><![CDATA[Cluster:]]></text> </staticText> <staticText> <reportElement positionType="Float" x="0" y="91" width="184" height="20"/> <textElement lineSpacing="Single"> <font size="12" isBold="true"/> </textElement> <text><![CDATA[scheduled Date:]]></text> </staticText> <staticText> <reportElement positionType="Float" x="0" y="111" width="184" height="20" isRemoveLineWhenBlank="true"> <printWhenExpression><![CDATA[$F{weatherWarnings} != null]]></printWhenExpression> </reportElement> <textElement lineSpacing="Single"> <font size="12" isBold="true"/> </textElement> <text><![CDATA[Adverse Weather Conditions:]]></text> </staticText> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement positionType="Float" x="184" y="71" width="371" height="20"/> <textElement lineSpacing="Single"> <font size="12"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{clusterName}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement positionType="Float" x="184" y="91" width="371" height="20"/> <textElement lineSpacing="Single"> <font size="12"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{scheduledDate}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement positionType="Float" x="184" y="111" width="371" height="20" isRemoveLineWhenBlank="true"> <printWhenExpression><![CDATA[$F{weatherWarnings} != null]]></printWhenExpression> </reportElement> <textElement lineSpacing="Single"> <font size="12"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{weatherWarnings}]]></textFieldExpression> </textField> <subreport runToBottom="false"> <reportElement positionType="Float" stretchType="RelativeToBandHeight" mode="Opaque" x="0" y="131" width="555" height="568"/> <parametersMapExpression><![CDATA[$P{REPORT_PARAMETERS_MAP}]]></parametersMapExpression> <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{sitesList})]]></dataSourceExpression> <subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "summary_sites_copy.jasper"]]></subreportExpression> </subreport> </band> <band height="148"> <componentElement> <reportElement positionType="Float" stretchType="RelativeToBandHeight" x="0" y="22" width="555" height="72"/> <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd"> <datasetRun subDataset="AggregationDataset"> <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{categoryList})]]></dataSourceExpression> </datasetRun> <jr:column width="155"> <jr:columnHeader style="table_CH" height="20" rowSpan="1"> <staticText> <reportElement x="0" y="0" width="155" height="20"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12" isBold="true"/> </textElement> <text><![CDATA[Category]]></text> </staticText> </jr:columnHeader> <jr:detailCell style="table_TD" height="20" rowSpan="1"> <textField> <reportElement x="0" y="0" width="155" height="20"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{categoryName}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="155"> <jr:columnHeader style="table_CH" height="20" rowSpan="1"> <staticText> <reportElement x="0" y="0" width="155" height="20"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12" isBold="true"/> </textElement> <text><![CDATA[Jobs/Category (#/%)]]></text> </staticText> </jr:columnHeader> <jr:detailCell style="table_TD" height="20" rowSpan="1"> <textField> <reportElement x="0" y="0" width="155" height="20"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{categoryValue}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> </jr:table> </componentElement> </band> </detail> <pageFooter> <band height="103"> <line> <reportElement x="0" y="10" width="515" height="1"/> </line> <textField> <reportElement x="200" y="20" width="80" height="15"/> <textElement textAlignment="Right" lineSpacing="Single"/> <textFieldExpression class="java.lang.String"><![CDATA["Page " + String.valueOf($V{PAGE_NUMBER}) + " of"]]></textFieldExpression> </textField> <textField evaluationTime="Report"> <reportElement x="280" y="20" width="75" height="15"/> <textElement lineSpacing="Single"/> <textFieldExpression class="java.lang.String"><![CDATA[" " + String.valueOf($V{PAGE_NUMBER})]]></textFieldExpression> </textField> </band> </pageFooter></jasperReport>
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