Jump to content
Changes to the Jaspersoft community edition download ×

Problem with grouping


mathewrond

Recommended Posts

Hi,

I have a problem displaying all the records based on portfolio ID. Its generates 1 page report with 3 records. But there are 3 portfolio id's with 13, 7, 2 records in the xml file.

 

 

If I use <groupExpression><![CDATA[$V{REPORT_COUNT}]]></groupExpression>

It prints me all the records but then they are not grouped by.

 

If I use isStartNewPage="true" it prints me only one record per page and the rest of the space in each page is blank.

 

 

Below is my <group> tag

 

Code:

<group name="DetailGroup" isStartNewPage="true">
<groupExpression><![CDATA[$F{PortfolioID}]]></groupExpression>
<groupHeader>
<band height="8" >
<subreport isUsingCache="true">
<reportElement
x="0"
y="0"
width="721"
height="8"
forecolor="#FFFFFF"
key="subreport2"
positionType="Float"/>
<subreportParameter name="PortfolioID">
<subreportParameterExpression><![CDATA[$F{PortfolioID}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="TransactionCode">
<subreportParameterExpression><![CDATA[$F{TransactionCode}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="XML_DATA_DOCUMENT">
<subreportParameterExpression><![CDATA[$P{XML_DATA_DOCUMENT}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<returnValue subreportVariable="REPORT_COUNT" toVariable="TradeCount" calculation="Sum"/>
<subreportExpression class="java.lang.String"><![CDATA["C:\projects\format1_head_info.jasper"]]></subreportExpression>
</subreport>
</band>
</groupHeader>
<groupFooter>
<band height="0" isSplitAllowed="true" >
</band>
</groupFooter>
</group>

 

Is this an expected behaviour? Actually I need the report in this way.

 

Each page can display upto 4 records and there are 22 total records in the xml file linked to 3 portfolio ID's.

 

So, for 1st portfolio id (13 records) it will be till 4th page.

2nd portfolio id(7 records) will start from 5th page to 6th page.

3rd portfolio id(2 records) will start from 7th page and end at 7th page

 

Can someone throw light on me please?

 

Mathew

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

I guess you should make two groups (don't know exactly if it will work within just one).

 

first group is for field "$F{PortfolioID}"

 

Second group should go for variable $V{REPORT_COUNT} where you should divide by 4 where the rest is 0 (the MOD division) with StartAtNewPage Attribute = true.

 

(search the forum for "limit records per page" .. I remember having read this some days/weeks/month ago)

 

If this work you could try to merge these groups with an logical AND ( && ). Perhaps this works also.

 

Never tried, just my thoughts.

 

hth

C-Box

Post edited by: CBox, at: 2006/10/23 11:48

Link to comment
Share on other sites

  • 2 weeks later...

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