2004 IR Help Posted September 2, 2006 Share Posted September 2, 2006 By: hj1122 - hj1122 $P{REPORT_CONNECTION} error 2004-10-05 03:42 Hi there; I'm a newbie for iReport, I implemented several reports from Tomcat, and they all work well. However, when it comes to subreport, iReport always can't run in the case I set connection expression as $P{REPORT_CONNECTION} . It stuck at fill report stage. The source code of jrxml is shown below: <?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="jreport_r07" columnCount="1" printOrder="Vertical" orientation="Portrait" pageWidth="842" pageHeight="595" columnWidth="782" columnSpacing="0" leftMargin="30" rightMargin="30" topMargin="20" bottomMargin="20" whenNoDataType="NoPages" isTitleNewPage="false" isSummaryNewPage="false"> <property name="ireport.scriptlethandling" value="2" /> <parameter name="sub1" isForPrompting="true" class="java.lang.Object"> <defaultValueExpression ><![CDATA["jSubreport_r02.jasper"]]></defaultValueExpression> </parameter> <parameter name="greek" isForPrompting="true" class="java.lang.String"/> <queryString><![CDATA[exec mr_get_und @id_typ_node1='DESK', @id_group=1, @id_typ_sort='am_delta', @id_pointwise=1, @id_cl_asset_und='ALL', @id_point_vega=0, @id_own_bus=3, @id_node1=15000020]]></queryString> <field name="nm_imnt" class="java.lang.String"> <fieldDescription><![CDATA[nm_imnt]]></fieldDescription> </field> <field name="nm_upper_node" class="java.lang.String"/> <field name="id_typ_imnt" class="java.lang.String"/> <field name="id_param_rsk" class="java.lang.String"> <fieldDescription><![CDATA[id_param_rsk]]></fieldDescription> </field> <field name="am_exp_rsk" class="java.lang.Double"> <fieldDescription><![CDATA[am_exp_rsk]]></fieldDescription> </field> <field name="region_dt_bus" class="java.lang.String"/> <variable name="test" class="java.lang.String" resetType="None" calculation="Nothing"> <variableExpression><![CDATA["test"]]></variableExpression> <initialValueExpression><![CDATA["test" ]]></initialValueExpression> </variable> <background> <band height="0" isSplitAllowed="true" > </band> </background> <title> <band height="49" isSplitAllowed="true" > <staticText> <reportElement mode="Opaque" x="0" y="0" width="782" height="49" forecolor="#FFFFFF" backcolor="#339AFF" key="staticText-1" stretchType="NoStretch" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Middle" rotation="None" lineSpacing="Single"> <font fontName="Helvetica" pdfFontName="Helvetica" size="24" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" /> </textElement> <text><![CDATA[underlying Concentration Report - EDG]]></text> </staticText> </band> </title> <pageHeader> <band height="0" isSplitAllowed="true" > </band> </pageHeader> <columnHeader> <band height="17" isSplitAllowed="true" > <staticText> <reportElement mode="Opaque" x="0" y="0" width="127" height="17" forecolor="#FFFFFF" backcolor="#339AFF" key="staticText-2" stretchType="NoStretch" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Center" verticalAlignment="Top" rotation="None" lineSpacing="Single"> <font fontName="Helvetica" pdfFontName="Helvetica" size="12" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" /> </textElement> <text><![CDATA[DELTA]]></text> </staticText> <staticText> <reportElement mode="Opaque" x="130" y="0" width="126" height="17" forecolor="#FFFFFF" backcolor="#339AFF" key="staticText-3" stretchType="NoStretch" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Center" verticalAlignment="Top" rotation="None" lineSpacing="Single"> <font fontName="Helvetica" pdfFontName="Helvetica" size="12" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" /> </textElement> <text><![CDATA[GAMMA]]></text> </staticText> <staticText> <reportElement mode="Opaque" x="518" y="0" width="126" height="17" forecolor="#FFFFFF" backcolor="#339AFF" key="staticText-4" stretchType="NoStretch" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Center" verticalAlignment="Top" rotation="None" lineSpacing="Single"> <font fontName="Helvetica" pdfFontName="Helvetica" size="12" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" /> </textElement> <text><![CDATA[MU]]></text> </staticText> <staticText> <reportElement mode="Opaque" x="260" y="0" width="126" height="17" forecolor="#FFFFFF" backcolor="#339AFF" key="staticText-5" stretchType="NoStretch" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Center" verticalAlignment="Top" rotation="None" lineSpacing="Single"> <font fontName="Helvetica" pdfFontName="Helvetica" size="12" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" /> </textElement> <text><![CDATA[VEGA]]></text> </staticText> <staticText> <reportElement mode="Opaque" x="390" y="0" width="122" height="17" forecolor="#FFFFFF" backcolor="#339AFF" key="staticText-6" stretchType="NoStretch" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Center" verticalAlignment="Top" rotation="None" lineSpacing="Single"> <font fontName="Helvetica" pdfFontName="Helvetica" size="12" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" /> </textElement> <text><![CDATA[RT VEGA SKEW]]></text> </staticText> <staticText> <reportElement mode="Opaque" x="650" y="0" width="129" height="17" forecolor="#FFFFFF" backcolor="#339AFF" key="staticText-7" stretchType="NoStretch" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Center" verticalAlignment="Top" rotation="None" lineSpacing="Single"> <font fontName="Helvetica" pdfFontName="Helvetica" size="12" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" /> </textElement> <text><![CDATA[CRED RHO]]></text> </staticText> </band> </columnHeader> <detail> <band height="23" isSplitAllowed="true" > <subreport isUsingCache="true"> <reportElement mode="Opaque" x="4" y="0" width="120" height="23" forecolor="#000000" backcolor="#FFFFFF" key="subreport-1" stretchType="NoStretch" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <subreportParameter name="greek"> <subreportParameterExpression><![CDATA[$F{id_param_rsk}]]></subreportParameterExpression> </subreportParameter> <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression> <subreportExpression class="java.lang.String"><![CDATA["jSubreport_r02.jasper"]]></subreportExpression> </subreport> </band> </detail> <columnFooter> <band height="0" isSplitAllowed="true" > </band> </columnFooter> <pageFooter> <band height="20" isSplitAllowed="true" > <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement mode="Transparent" x="572" y="0" width="174" height="19" forecolor="#000000" backcolor="#FFFFFF" key="textField" stretchType="NoStretch" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Right" verticalAlignment="Top" rotation="None" lineSpacing="Single"> <font fontName="Helvetica" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.String"><![CDATA["Page " + $V{PAGE_NUMBER} + " of "]]></textFieldExpression> </textField> <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Report" hyperlinkType="None" > <reportElement mode="Transparent" x="746" y="0" width="36" height="19" forecolor="#000000" backcolor="#FFFFFF" key="textField" stretchType="NoStretch" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" rotation="None" lineSpacing="Single"> <font fontName="Helvetica" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.String"><![CDATA["" + $V{PAGE_NUMBER}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement mode="Transparent" x="1" y="0" width="209" height="19" forecolor="#000000" backcolor="#FFFFFF" key="textField" stretchType="NoStretch" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" rotation="None" lineSpacing="Single"> <font fontName="Helvetica" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.util.Date"><![CDATA[new Date()]]></textFieldExpression> </textField> </band> </pageFooter> <summary> <band height="0" isSplitAllowed="true" > </band> </summary> </jasperReport> can anyone please give me some light? Thanks in advance!!! By: hj1122 - hj1122 RE: $P{REPORT_CONNECTION} error 2004-10-05 03:51 In case that no connections or datasources are used, it returns a blank file. In both cases, they can both be compiled. The subreport source code is <?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="jSubreport_r02" columnCount="1" printOrder="Vertical" orientation="Portrait" pageWidth="595" pageHeight="842" columnWidth="535" columnSpacing="0" leftMargin="30" rightMargin="30" topMargin="20" bottomMargin="20" whenNoDataType="NoPages" isTitleNewPage="false" isSummaryNewPage="false"> <property name="ireport.scriptlethandling" value="2" /> <parameter name="greek" isForPrompting="true" class="java.lang.String"/> <queryString><![CDATA[exec mr_get_und @id_typ_node1='DESK', @id_group=1, @id_typ_sort='am_delta', @id_pointwise=1, @id_cl_asset_und='ALL', @id_point_vega=0, @id_own_bus=3, @id_node1=15000020, @id_single_param = 1 , @id_param_rsk= $P{greek}]]></queryString> <field name="nm_imnt" class="java.lang.String"> <fieldDescription><![CDATA[nm_imnt]]></fieldDescription> </field> <field name="nm_upper_node" class="java.lang.String"/> <field name="id_typ_imnt" class="java.lang.String"/> <field name="id_param_rsk" class="java.lang.String"> <fieldDescription><![CDATA[id_param_rsk]]></fieldDescription> </field> <field name="am_exp_rsk" class="java.lang.Double"> <fieldDescription><![CDATA[am_exp_rsk]]></fieldDescription> </field> <field name="region_dt_bus" class="java.lang.String"/> <variable name="test" class="java.lang.String" resetType="None" calculation="Nothing"> <variableExpression><![CDATA["test"]]></variableExpression> <initialValueExpression><![CDATA["test"]]></initialValueExpression> </variable> <background> <band height="0" isSplitAllowed="true" > </band> </background> <title> <band height="0" isSplitAllowed="true" > </band> </title> <pageHeader> <band height="0" isSplitAllowed="true" > </band> </pageHeader> <columnHeader> <band height="0" isSplitAllowed="true" > </band> </columnHeader> <detail> <band height="17" isSplitAllowed="true" > <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement mode="Opaque" x="0" y="0" width="267" height="17" forecolor="#000000" backcolor="#FFFFFF" key="textField" stretchType="NoStretch" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Middle" rotation="None" lineSpacing="Single"> <font fontName="" pdfFontName="Helvetica" size="12" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="CP1252" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{nm_imnt}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="false" pattern="#,##0;(#,##0)" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement mode="Transparent" x="270" y="0" width="207" height="17" forecolor="#000000" backcolor="#FFFFFF" key="textField-1" stretchType="NoStretch" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" lineSpacing="Single"> <font fontName="" pdfFontName="Helvetica" size="12" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="CP1252" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.Double"><![CDATA[new Double($F{am_exp_rsk}.doubleValue()/1000.00)]]></textFieldExpression> </textField> <textField isStretchWithOverflow="false" pattern="#,##0;(#,##0)" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement mode="Opaque" x="270" y="0" width="207" height="17" forecolor="#FF3333" backcolor="#FFFFFF" key="textField-2" stretchType="NoStretch" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"> <printWhenExpression><![CDATA[$F{am_exp_rsk}.intValue() < -500 ? Boolean.TRUE : Boolean.FALSE]]></printWhenExpression> </reportElement> <textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" lineSpacing="Single"> <font fontName="" pdfFontName="Helvetica" size="12" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="CP1252" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.Double"><![CDATA[new Double($F{am_exp_rsk}.doubleValue()/1000.00)]]></textFieldExpression> </textField> </band> </detail> <columnFooter> <band height="0" isSplitAllowed="true" > </band> </columnFooter> <pageFooter> <band height="0" isSplitAllowed="true" > </band> </pageFooter> <summary> <band height="0" isSplitAllowed="true" > </band> </summary> </jasperReport> I'd really appreciate if any of you can give me some advice! 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