2006 JR Open Discussion Posted August 21, 2006 Share Posted August 21, 2006 By: Makarand - mkharche Subreport not showing up 2006-01-04 02:18Hi, I have a subreport element inside the details section of the master report. This subreport has nothing but the details section, with some text fields in it. The design is pretty much like the following : <detail> | Item related textfields | | Static: Above item consists of the following: | | Subreport element | </detail> In such a design, I could see that the data is getting fetched propoerly on the report, however the subreport doesnt show up. However, if I keep some blank space between the subreport element and the static text, in the design, and then try generating the report, then the report gets generated fine, with alignment issues ofcourse. Any one can help me find out the problem ? Thanks. Following is an excerpt of the details section in my design : <detail> <band height="43" isSplitAllowed="true" > <printWhenExpression><![CDATA[$P{SHOW_QUOTE}]]></printWhenExpression> <elementGroup> <textField isStretchWithOverflow="true" pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement mode="Transparent" x="463" y="0" width="69" height="16" forecolor="#000000" backcolor="#FFFFFF" key="textField-151" stretchType="RelativeToTallestObject" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"> <printWhenExpression><![CDATA[$P{SHOW_QUOTE}]]></printWhenExpression> </reportElement> <box topBorder="None" topBorderColor="#000000" topPadding="2" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="Thin" rightBorderColor="#000000" rightPadding="2" bottomBorder="Thin" bottomBorderColor="#000000" bottomPadding="2"/> <textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" lineSpacing="Single"> <font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{item.price.extendedSellingPrice}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement mode="Transparent" x="465" y="4" width="14" height="7" forecolor="#000000" backcolor="#FFFFFF" key="textField-152" stretchType="RelativeToTallestObject" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"> <printWhenExpression><![CDATA[new Boolean(false)]]></printWhenExpression> </reportElement> <box topBorder="None" topBorderColor="#000000" topPadding="2" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="None" rightBorderColor="#000000" rightPadding="2" bottomBorder="None" bottomBorderColor="#000000" bottomPadding="2"/> <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> <textFieldExpression class="java.lang.Integer"><![CDATA[$F{totalLineItemsInItem}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true" evaluationTime="Group" evaluationGroup="lineItemGroup" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement mode="Transparent" x="2" y="0" width="51" height="16" forecolor="#000000" backcolor="#FFFFFF" key="textField-153" stretchType="RelativeToTallestObject" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"> <printWhenExpression><![CDATA[$P{SHOW_QUOTE}]]></printWhenExpression> </reportElement> <box topBorder="None" topBorderColor="#000000" topPadding="2" leftBorder="Thin" leftBorderColor="#000000" leftPadding="2" rightBorder="Thin" rightBorderColor="#000000" rightPadding="2" bottomBorder="Thin" bottomBorderColor="#000000" bottomPadding="2"/> <textElement textAlignment="Left" verticalAlignment="Middle" rotation="None" lineSpacing="Single"> <font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.Integer"><![CDATA[$V{ITEM_SER_NO}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement mode="Transparent" x="53" y="0" width="93" height="16" forecolor="#000000" backcolor="#FFFFFF" key="textField-154" stretchType="RelativeToTallestObject" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"> <printWhenExpression><![CDATA[$P{SHOW_QUOTE}]]></printWhenExpression> </reportElement> <box topBorder="None" topBorderColor="#000000" topPadding="2" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="Thin" rightBorderColor="#000000" rightPadding="2" bottomBorder="Thin" bottomBorderColor="#000000" bottomPadding="2"/> <textElement textAlignment="Left" verticalAlignment="Middle" rotation="None" lineSpacing="Single"> <font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{item.name}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement mode="Transparent" x="146" y="0" width="128" height="16" forecolor="#000000" backcolor="#FFFFFF" key="textField-155" stretchType="RelativeToTallestObject" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"> <printWhenExpression><![CDATA[$P{SHOW_QUOTE}]]></printWhenExpression> </reportElement> <box topBorder="None" topBorderColor="#000000" topPadding="2" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="Thin" rightBorderColor="#000000" rightPadding="2" bottomBorder="Thin" bottomBorderColor="#000000" bottomPadding="2"/> <textElement textAlignment="Left" verticalAlignment="Middle" rotation="None" lineSpacing="Single"> <font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{item.description}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="true" pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement mode="Transparent" x="335" y="0" width="64" height="16" forecolor="#000000" backcolor="#FFFFFF" key="textField-156" stretchType="RelativeToTallestObject" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"> <printWhenExpression><![CDATA[$P{SHOW_QUOTE}]]></printWhenExpression> </reportElement> <box topBorder="None" topBorderColor="#000000" topPadding="2" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="Thin" rightBorderColor="#000000" rightPadding="2" bottomBorder="Thin" bottomBorderColor="#000000" bottomPadding="2"/> <textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" lineSpacing="Single"> <font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{item.price.extendedListPrice}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement mode="Transparent" x="274" y="0" width="61" height="16" forecolor="#000000" backcolor="#FFFFFF" key="textField-157" stretchType="RelativeToTallestObject" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"> <printWhenExpression><![CDATA[$P{SHOW_QUOTE}]]></printWhenExpression> </reportElement> <box topBorder="None" topBorderColor="#000000" topPadding="2" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="Thin" rightBorderColor="#000000" rightPadding="2" bottomBorder="Thin" bottomBorderColor="#000000" bottomPadding="2"/> <textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" lineSpacing="Single"> <font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.Integer"><![CDATA[$F{item.quantity}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement mode="Transparent" x="399" y="0" width="64" height="16" forecolor="#000000" backcolor="#FFFFFF" key="textField-158" stretchType="RelativeToTallestObject" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"> <printWhenExpression><![CDATA[$P{SHOW_QUOTE}]]></printWhenExpression> </reportElement> <box topBorder="None" topBorderColor="#000000" topPadding="2" leftBorder="None" leftBorderColor="#000000" leftPadding="2" rightBorder="Thin" rightBorderColor="#000000" rightPadding="2" bottomBorder="Thin" bottomBorderColor="#000000" bottomPadding="2"/> <textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" lineSpacing="Single"> <font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[new java.text.DecimalFormat("##############0.00").format($F{item.price.discountPercent}.doubleValue())+"%"]]></textFieldExpression> </textField> </elementGroup> <subreport isUsingCache="true"> <reportElement mode="Opaque" x="2" y="29" width="531" height="13" forecolor="#000000" backcolor="#FFFFFF" key="subreport-1" stretchType="NoStretch" positionType="Float" isPrintRepeatedValues="true" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"> <printWhenExpression><![CDATA[new Boolean(($P{SHOW_QUOTE}.booleanValue() == true) && ($P{SHOW_QUOTE_DETAIL}.booleanValue() == true) && $F{totalLineItemsInItem}.intValue() > 0)]]></printWhenExpression> </reportElement> <subreportParameter name="ITEM_ID"> <subreportParameterExpression><![CDATA[$F{item.id}]]></subreportParameterExpression> </subreportParameter> <subreportParameter name="ITEM_SER_NO"> <subreportParameterExpression><![CDATA[$V{ITEM_SER_NO}]]></subreportParameterExpression> </subreportParameter> <dataSourceExpression><![CDATA[$P{ITEMSREPORT_DATASOURCE}]]></dataSourceExpression> <subreportExpression class="net.sf.jasperreports.engine.JasperReport"><![CDATA[$P{ITEMSREPORT_LOCATION}]]></subreportExpression> </subreport> <staticText> <reportElement mode="Transparent" x="1" y="16" width="530" height="13" forecolor="#000000" backcolor="#FFFFFF" key="staticText-138" stretchType="NoStretch" positionType="Float" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"> <printWhenExpression><![CDATA[new Boolean(($P{SHOW_QUOTE}.booleanValue() == true) && ($P{SHOW_QUOTE_DETAIL}.booleanValue() == true) && $F{totalLineItemsInItem}.intValue() > 0)]]></printWhenExpression> </reportElement> <box topBorder="None" topBorderColor="#000000" leftBorder="Thin" leftBorderColor="#000000" rightBorder="Thin" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement textAlignment="Left" verticalAlignment="Middle" 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[Above configuration consists of the following items:]]></text> </staticText> </band> </detail> - Thanks Makarand. By: Yongzi - yongzi How to create a subreport with only Static te 2006-01-04 03:49If the subreport is nothing else than static images and text, you should NOT place any element into the "Detail" section (actually, it is a good idea to delete the detail section), and then change the "Report Property" --> "When No Data Print" to "All Sections No Detail"; this could, however, ensure the faultless display of the subreport in the master report. And then switch the layout to the master report design, add a "Subreport" element onto the layout, set the "Subreport" --> "Expression" with proper value (in this case, you don't have to (or must not) touch the "Connection Expression" and "Data Source Expression" areas, otherwise, the data in the master report may not be displayed properly). Preview should now display the expected page. PS: It is suggested to set the margins in the subreport to 0! Link to comment Share on other sites More sharing options...
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