I've chart report which uses the parameter of Type Java.util.collection. When I try to use this chart at group band as subreport to the Main report with similar parameter of Type Java.util.collection, the chart value keep iterates within the group. For example, if the chart shows the value for L1 & L2 in two separate page. But when added to the Main report for the value L1, the subreport displays both L1 & L2 rather than just L1.
Could I able to display just L1 from subreport when the parameter is passed as L1, not both L& L2 in the group band?
FYI, using Jaspersoft Studio 5.6.1
EDIT:
Suppose I am passing 2 Projects P1 and P2 as parameters from main report, the result now I am getting is:
- 1st page Main report data P1
- Sub report data P1
- Sub report data P2
- 2nd page Main report Data P2
- Sub report data P1
- Sub report data P2
But, the desired result should be like this:
- 1st page Main report data P1
- Sub report data P1
- 2nd page Main report Data P2
- Sub report data P2.
I've added the subreport in one of the Group header.
Main Report:
<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="test_subreport" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="d2616041-39f3-44ce-a1e4-4ce5a6a1593c">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="Dev DB Conn" />
<parameter name="param_project" class="java.util.collection" nestedType="java.lang.Integer">
<parameterDescription>
<![CDATA[]]>
</parameterDescription>
</parameter>
<queryString language="SQL">
<![CDATA[SELECT
i.id prid,c.INUSAGE,d.CURRUSAGE
FROM
project table i, custom table c
where i.id = c.id and $X{IN,I.id,param_project}
]]>
</queryString>
<field name="prid" class="java.math.BigDecimal" />
<field name="INUSAGE" class="java.math.BigDecimal" />
<field name="CURRUSAGE" class="java.math.BigDecimal" />
<group name="Group1">
<groupExpression>
<![CDATA[$F{INVID}]]>
</groupExpression>
</group>
<columnHeader>
<band height="210">
<textField>
<reportElement x="0" y="80" width="80" height="30" uuid="263d8d17-1c40-4709-ba8f-76e27a976c75" />
<textFieldExpression>
<![CDATA[$F{prid}]]>
</textFieldExpression>
</textField>
<subreport>
<reportElement isPrintRepeatedValues="false" x="80" y="2" width="200" height="200" uuid="da630714-b937-493c-9db5-a4baa7128f3d" />
<subreportParameter name="param_invID">
<subreportParameterExpression>
<![CDATA[$P{param_project}]]>
</subreportParameterExpression>
</subreportParameter>
<connectionExpression>
<![CDATA[$P{REPORT_CONNECTION}]]>
</connectionExpression>
<subreportExpression>
<![CDATA["Workload1_added_collection_group1.jasper"]]>
</subreportExpression>
</subreport>
</band>
</columnHeader>
Subreport link: subreport
Thanks
Sreeram
jrxml
information as well as screenshots if possible. What is the way you want it? Where in the main report did you put it? – tobi6