Jump to content
JasperReports Library 7.0 is now available ×

new page break


2006 IR Open Dicussion

Recommended Posts

By: Rob Karatzas - tutor

new page break

2006-05-10 03:55

hi folks

 

I'm following trying something similar to the 'new page break' example on pg. 206 of the v1.2.0 manual. (Initially, the report worked fine using a subreport title band/new page process.)

 

Basically, the report consists of a main and 2 subreports. (CAD drawing on pg 1 with notes subreport and then parts ALWAYS listed on pg. 2, so they are side by side from a print. Customer was seeing several MAIN pages not having images, so they decided, if a CAD drawing in MAIN has no image (which means no notes subreport), then they wanted the parts page to start on page 1 instead of pg.2.)

 

Using grouping, the group should kick out the parts subreport on a new page, ONLY when the image is not null. However, the 'start on new page' check doesn't seem to be functional.

 

Here's the jrxml:

 

 

<?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="IllustrationPrintFilev9"

columnCount="1"

printOrder="Vertical"

orientation="Portrait"

pageWidth="612"

pageHeight="792"

columnWidth="552"

columnSpacing="0"

leftMargin="30"

rightMargin="30"

topMargin="20"

bottomMargin="20"

whenNoDataType="NoPages"

isTitleNewPage="false"

isSummaryNewPage="false">

<property name="ireport.scriptlethandling" value="0" />

<property name="ireport.encoding" value="UTF-8" />

<import value="java.util.*" />

<import value="net.sf.jasperreports.engine.*" />

<import value="net.sf.jasperreports.engine.data.*" />

 

<parameter name="CADFILEID" isForPrompting="false" class="java.lang.String">

<defaultValueExpression ><![CDATA["4702, 4693, 1147, 1058, 1060"]]></defaultValueExpression>

</parameter>

<parameter name="MCADFILEID" isForPrompting="false" class="java.math.BigDecimal"/>

<queryString><![CDATA[sELECT

--blb.FILEBLOB AS FILEIMG,

CASE WHEN fle.FLETYPID >= 1201 AND fle.FLETYPID <= 1205 THEN blb.FILEBLOB

ELSE NULL END AS FILEIMG,

ill.CADFILEID AS CADFILEID, UPPER(ill.ENAME) AS ILLNAME , ill.VERNO AS ILLVERNO, ill.DSCR AS DSCR, TO_CHAR(SYSDATE, 'MM/DD/YYYY HH24:MI:SS

 

AM')"CURRENT_DATENTIME"

FROM (ILLILL ill

LEFT OUTER JOIN POJREFFLE REF ON REF.REFID = ill.CADFILEID

LEFT OUTER JOIN APPDEFFLE fle ON REF.FLEID = fle.FLEID)

LEFT OUTER JOIN APPDEFFLEDAT blb ON fle.FLEID = blb.FLEID

WHERE (REF.POJID = 2011 OR POJID IS NULL)

AND ill.CADFILEID in ($P!{CADFILEID})

ORDER BY ILLNAME, ILLVERNO]]></queryString>

 

<field name="FILEIMG" class="oracle.sql.BLOB"/>

<field name="CADFILEID" class="java.math.BigDecimal"/>

<field name="ILLNAME" class="java.lang.String"/>

<field name="ILLVERNO" class="java.math.BigDecimal"/>

<field name="DSCR" class="java.lang.String"/>

<field name="CURRENT_DATENTIME" class="java.lang.String"/>

 

 

<group name="Ill" isStartNewPage="true" isResetPageNumber="true" isReprintHeaderOnEachPage="true" >

<groupExpression><![CDATA[$F{CADFILEID}]]></groupExpression>

<groupHeader>

<band height="0" isSplitAllowed="true" >

</band>

</groupHeader>

<groupFooter>

<band height="0" isSplitAllowed="true" >

</band>

</groupFooter>

</group>

<group name="PageDetail" >

<groupExpression><![CDATA[null]]></groupExpression>

<groupHeader>

<band height="438" isSplitAllowed="true" >

<image scaleImage="RetainShape" vAlign="Top" hAlign="Left" isUsingCache="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

mode="Opaque"

x="4"

y="1"

width="540"

height="348"

forecolor="#000000"

backcolor="#FFFFFF"

key="image-3"

stretchType="RelativeToTallestObject"

positionType="FixRelativeToTop"

isPrintRepeatedValues="false"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<graphicElement stretchType="RelativeToTallestObject" pen="None" fill="Solid"

/>

<imageExpression class="java.io.InputStream"><![CDATA[($F{FILEIMG}).getBinaryStream()]]></imageExpression>

</image>

<subreport isUsingCache="false">

<reportElement

mode="Opaque"

x="4"

y="353"

width="545"

height="85"

forecolor="#000000"

backcolor="#FFFFFF"

key="subreport-2"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<subreportParameter name="MAINCADFILEID">

<subreportParameterExpression><![CDATA[$F{CADFILEID}]]></subreportParameterExpression>

</subreportParameter>

<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>

<subreportExpression class="java.lang.String"><![CDATA["subIllustrationNote.jasper"]]></subreportExpression>

</subreport>

</band>

</groupHeader>

<groupFooter>

<band height="93" isSplitAllowed="true" >

<subreport isUsingCache="false">

<reportElement

mode="Opaque"

x="4"

y="6"

width="545"

height="85"

forecolor="#000000"

backcolor="#FFFFFF"

key="subreport-1"

stretchType="RelativeToBandHeight"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<subreportParameter name="MAINCADFILEID">

<subreportParameterExpression><![CDATA[$F{CADFILEID}]]></subreportParameterExpression>

</subreportParameter>

<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>

<subreportExpression class="java.lang.String"><![CDATA["subIllustrationPrintv9.jasper"]]></subreportExpression>

</subreport>

</band>

</groupFooter>

</group>

<group name="PageBreaker" isStartNewPage="true" >

<groupExpression><![CDATA[$F{CADFILEID}]]></groupExpression>

<groupHeader>

<band height="26" isSplitAllowed="true" >

<printWhenExpression><![CDATA[new Boolean($F{FILEIMG}!=null)]]></printWhenExpression>

</band>

</groupHeader>

<groupFooter>

<band height="22" isSplitAllowed="true" >

</band>

</groupFooter>

</group>

<background>

<band height="0" isSplitAllowed="true" >

</band>

</background>

<title>

<band height="0" isSplitAllowed="true" >

</band>

</title>

<pageHeader>

<band height="92" isSplitAllowed="false" >

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

mode="Opaque"

x="359"

y="33"

width="32"

height="16"

forecolor="#FFFFFF"

backcolor="#FFFFFF"

key="textField-8"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="false"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica" size="18" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{CADFILEID}]]></textFieldExpression>

</textField>

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

mode="Transparent"

x="0"

y="33"

width="352"

height="18"

forecolor="#000000"

backcolor="#FFFFFF"

key="textField-5"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica-Bold" size="10" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA[$F{ILLNAME}+ ' ' + 'v'+ $F{ILLVERNO}]]></textFieldExpression>

</textField>

<staticText>

<reportElement

mode="Transparent"

x="396"

y="36"

width="156"

height="21"

forecolor="#000000"

backcolor="#FFFFFF"

key="staticText-4"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica-Bold" size="10" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<text><![CDATA[status CR PCN]]></text>

</staticText>

<staticText>

<reportElement

mode="Transparent"

x="396"

y="60"

width="50"

height="30"

forecolor="#000000"

backcolor="#FFFFFF"

key="staticText-5"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<text><![CDATA[DRAFT]]></text>

</staticText>

<image scaleImage="RetainShape" vAlign="Top" hAlign="Center" isUsingCache="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

mode="Opaque"

x="146"

y="0"

width="325"

height="25"

forecolor="#000000"

backcolor="#FFFFFF"

key="barcode-1"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<graphicElement stretchType="NoStretch" pen="None" fill="Solid"

/>

<imageExpression class="java.awt.Image"><![CDATA[it.businesslogic.ireport.barcode.BcImage.getBarcodeImage(2,$F{ILLNAME},false,false,null,0,0)]]></imageExpression>

</image>

<image scaleImage="RetainShape" vAlign="Top" hAlign="Left" isUsingCache="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

mode="Opaque"

x="494"

y="0"

width="58"

height="25"

forecolor="#000000"

backcolor="#FFFFFF"

key="barcode-2"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<graphicElement stretchType="NoStretch" pen="None" fill="Solid"

/>

<imageExpression class="java.awt.Image"><![CDATA[it.businesslogic.ireport.barcode.BcImage.getBarcodeImage(2,$F{ILLVERNO},false,false,null,0,0)]]></imageExpression>

</image>

<image scaleImage="FillFrame" vAlign="Top" hAlign="Left" isUsingCache="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

mode="Opaque"

x="2"

y="0"

width="138"

height="27"

forecolor="#000000"

backcolor="#FFFFFF"

key="image-2"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<graphicElement stretchType="NoStretch" pen="None" fill="Solid"

/>

<imageExpression class="java.lang.String"><![CDATA["pslogo1.gif"]]></imageExpression>

</image>

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

mode="Transparent"

x="0"

y="54"

width="385"

height="36"

forecolor="#000000"

backcolor="#FFFFFF"

key="textField-10"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica-Bold" size="10" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA[$F{DSCR}]]></textFieldExpression>

</textField>

</band>

</pageHeader>

<columnHeader>

<band height="0" isSplitAllowed="true" >

</band>

</columnHeader>

<detail>

<band height="3" isSplitAllowed="true" >

</band>

</detail>

<columnFooter>

<band height="1" isSplitAllowed="true" >

</band>

</columnFooter>

<pageFooter>

<band height="20" isSplitAllowed="true" >

<staticText>

<reportElement

mode="Transparent"

x="3"

y="2"

width="89"

height="18"

forecolor="#000000"

backcolor="#FFFFFF"

key="staticText-6"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica-Oblique" size="8" isBold="false" isItalic="true" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<text><![CDATA[uncontrolled Document]]></text>

</staticText>

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

mode="Transparent"

x="127"

y="2"

width="153"

height="18"

forecolor="#000000"

backcolor="#FFFFFF"

key="textField-9"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement textAlignment="Right" verticalAlignment="Top" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica" size="8" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA["Date Printed: " + $F{CURRENT_DATENTIME}]]></textFieldExpression>

</textField>

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

mode="Transparent"

x="282"

y="2"

width="227"

height="18"

forecolor="#000000"

backcolor="#FFFFFF"

key="textField"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement textAlignment="Right" verticalAlignment="Top" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica" size="8" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA["Page: " + $F{ILLNAME}+ " (" + $V{PAGE_NUMBER} + " of "]]></textFieldExpression>

</textField>

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Report" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

mode="Transparent"

x="512"

y="2"

width="31"

height="18"

forecolor="#000000"

backcolor="#FFFFFF"

key="textField"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica" size="8" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA["" + $V{PAGE_NUMBER} + ")"]]></textFieldExpression>

</textField>

</band>

</pageFooter>

<summary>

<band height="5" isSplitAllowed="true" >

</band>

</summary>

</jasperReport>

 

thanks in advance for taking a look

rob

 

 

 

 

 

By: Rob Karatzas - tutor

SOLVED: new page break

2006-05-16 09:01

tried 2 or 3 approaches.

 

the last (and successful one) was to copy the subreport for parts and lay this on top of the CAD image.

 

basically, when CAD image == null show the new subreport. otherwise, when CAD image != null use the other subreport (which has the title on new page flag set).

 

rob

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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