Jump to content
Changes to the Jaspersoft community edition download ×

pass field values to subreport


abbey8908

Recommended Posts

Hello,

 

I'm really new for Jasperreport now.

I'm having a troble at passing field value from main report to sub report..

 

the following is my main report code;

            <subreport>
                <reportElement x="140" y="180" width="530" height="303" uuid="d23de6fe-970c-49e1-b747-0b1cdd2a7e86"/>
                <subreportParameter name="PIE_NM">
                    <subreportParameterExpression><![CDATA[$F{PIE_NM}]]></subreportParameterExpression>
                </subreportParameter>
                <subreportParameter name="RATIO">
                    <subreportParameterExpression><![CDATA[$F{RATIO}]]></subreportParameterExpression>
                </subreportParameter>
                <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource()]]></dataSourceExpression>
                <subreportExpression><![CDATA["reports/DBRD2040-1.jasper"]]></subreportExpression>
            </subreport>

 

the following is my sub report code;

    <field name="PIE_NM" class="java.lang.String"/>
    <field name="RATIO" class="java.math.BigDecimal"/>

     ...

                <pieDataset>
                    <keyExpression><![CDATA[$P{PIE_NM}]]></keyExpression>
                    <valueExpression><![CDATA[$P{RATIO}]]></valueExpression>
                    <labelExpression><![CDATA[$P{PIE_NM}]]></labelExpression>
                </pieDataset>

 

 

the followings are the field values 

PIE_NM  RATIO

95        Automatics
4         Manual
1         FAIL

 

what is expected to see from subreport was 95(Automatics)/4(Manual)/1(FAIL) ratio pie chart,

but what I actually got was 100(Automatics)

 

I guess this is becuase the parameter cannot send Array or List Object...

so it carried only one value - Automatics

 

is that correct?

if so, how can I pass field list value to subreport as a parameter?

 

Thanks in advance.

and sorry for my bad English.

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