Jump to content
Changes to the Jaspersoft community edition download ×

I have problems sending parameters to subreports


Ferru

Recommended Posts

Hi guys,  I'm trying to compile the reports for the 6.3.1 version of Jasper. I have created two reports. The report master has a parameter defined as seen here.

<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="EmployeeJT_New"               pageWidth="842" pageHeight="595"                orientation="Landscape"               whenNoDataType="AllSectionsNoDetail"               columnWidth="802"               leftMargin="20" rightMargin="20"               topMargin="20"  bottomMargin="20"               uuid="6a1b3d67-c3e0-4093-851b-b77403db7daf">    <property  name="com.jaspersoft.studio.data.sql.tables" value=""/>    <property  name="com.jaspersoft.studio.data.defaultdataadapter"               value="DataAdapter.xml"/>    <parameter name="C_BPartner_ID" class="java.lang.Integer"/>[/code]

I have also defined a subreport of the master report like this

<subreport>    <reportElement x="370" y="60"                   width="200" height="200"                   uuid="afa67f8b-2c28-4911-821a-13f8c9ad7166"/>    <subreportParameter name="C_BPartner_ID">        <subreportParameterExpression>            <![CDATA[$P{C_BPartner_ID}]]>        </subreportParameterExpression>    </subreportParameter>    <connectionExpression>        <![CDATA[$P{REPORT_CONNECTION}]]>    </connectionExpression>    <subreportExpression>        <![CDATA["SocialSecurity_New.jasper"]]>    </subreportExpression></subreport>[/code]

On the subreport, I need to get the information for the parameter C_BPartner_ID from the Master Report, and the report used on the subreport tag is defined like this

<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="SocialSecurity_New"                pageWidth="842" pageHeight="595"               orientation="Landscape"               columnWidth="802"               leftMargin="20" rightMargin="20"               topMargin="20" bottomMargin="20"               uuid="341e7758-9ef4-410f-b749-87489aa3ec8b">    <property  name="com.jaspersoft.studio.data.sql.tables" value=""/>    <property  name="com.jaspersoft.studio.data.defaultdataadapter"               value="DataAdapter.xml"/>    <parameter name="C_BPartner_ID"               class="java.lang.Integer"/>    <queryString language="SQL">        <![CDATA[sELECT fund.*, arl.*,fundBP.name from adempiere.c_bpartner part              JOIN adempiere.etitc_fund fund                  ON fund.c_bpartner_id = part.c_bpartner_id              left JOIN adempiere.he_arl arl                 on fund.he_arl_id = arl.he_arl_id              join adempiere.c_bpartner fundBP                 on fund.fund_bpartner = fundBP.c_bpartner_id              WHERE part.c_bpartner_ID = $P{C_BPartner_ID}]]>    </queryString>    <field name="fund_type"           class="java.lang.String">        <property name="com.jaspersoft.studio.field.label"                   value="fund_type"/>    </field>    <field name="risk_class"            class="java.lang.String">        <property name="com.jaspersoft.studio.field.label"                   value="risk_class"/>    </field>    <field name="rate"            class="java.math.BigDecimal">        <property name="com.jaspersoft.studio.field.label"                   value="rate"/>    </field>    <field name="name"            class="java.lang.String">        <property name="com.jaspersoft.studio.field.label"                   value="name"/>    </field>    <background>        <band splitType="Stretch"/>    </background>    <title>        <band height="79" splitType="Stretch"/>    </title>    <pageHeader>        <band height="35" splitType="Stretch"/>    </pageHeader>    <columnHeader>        <band height="66" splitType="Stretch"/>    </columnHeader>    <detail>        <band height="125" splitType="Stretch">            <textField>                <reportElement x="0" y="20"                                width="100" height="30"                                uuid="c6470abd-45ef-4325-a150-a2f576b5b95e"/>                <textElement>                    <font size="5"/>                </textElement>                <textFieldExpression>                    <![CDATA[$F{fund_type}.equals("AFP")?$F{name}:""]]>                </textFieldExpression>            </textField>            <textField>                <reportElement x="100" y="20"                                width="100" height="30"                                uuid="85c34fbb-91c8-424c-8da8-145a9a962fc1"/>                <textElement>                    <font size="5"/>                </textElement>                <textFieldExpression>                    <![CDATA[$F{fund_type}.equals("EPS")?$F{name}:""]]>                </textFieldExpression>            </textField>            <textField>                <reportElement x="200" y="20"                                width="100" height="30"                                uuid="01877244-3eba-4353-80c7-1d9f45cc4f96"/>                <textElement>                    <font size="5"/>                </textElement>                <textFieldExpression>                    <![CDATA[$F{fund_type}.equals("CCF")?$F{name}:""]]>                </textFieldExpression>            </textField>            <textField>                <reportElement x="300" y="20"                               width="100" height="30"                                uuid="ba066774-1500-418c-be5e-32c3afb321ad"/>                <textElement>                    <font size="5"/>                </textElement>                <textFieldExpression>                    <![CDATA[$F{fund_type}.equals("ARL")?$F{name}:""]]>                </textFieldExpression>            </textField>            <textField>                <reportElement x="400" y="20"                                width="100" height="30"                                uuid="924980ea-dae9-4fc7-bfe7-e545f63bb908"/>                <textElement>                    <font size="5"/>                </textElement>                <textFieldExpression>                    <![CDATA[$F{fund_type}.equals("AFP")?$F{risk_class}:""]]>                </textFieldExpression>            </textField>            <textField>                <reportElement x="500" y="20"                                width="100" height="30"                                uuid="c17210ed-d493-456b-8e74-b2335c26d9aa"/>                <textElement>                    <font size="5"/>                </textElement>                <textFieldExpression>                    <![CDATA[$F{fund_type}.equals("AFP")?$F{rate}:""]]>                </textFieldExpression>            </textField>        </band>    </detail>    <columnFooter>        <band height="45" splitType="Stretch"/>    </columnFooter>    <pageFooter>        <band height="54" splitType="Stretch"/>    </pageFooter>    <summary>        <band height="42" splitType="Stretch"/>    </summary></jasperReport>[/code]

but when I try to test it with the preview on jasper studio, it does not bring the information on the subreport, what could be  missing or what do I need to add, or configure, or check. The subreport works fine when tested alone.

Thanks for the answers.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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