Jump to content

restrict number of lines per page in iReport?


vans

Recommended Posts

  • Replies 10
  • Created
  • Last Reply

Top Posters In This Topic

Hi Giulio,

    thanks for your reply.

My issue is , number of records coming to REPORT_COUNT is not fixed , it is flexible.

and i want to show 5 lines per page in report..

 

if there are are 7 lines of data, 5 in first page ad remaining 2 in next page.

 

can you please give me a solution for this

 

thanks

vans



Post Edited by neha prasanth at 04/09/09 05:52
Link to comment
Share on other sites

Vans,

 

Giulio's answer does exactly what you are looking for. REPORT_COUNT certainly isn't a fixed value. Well, his example is for 10 rows per page. But changing "10" to "5" isn't difficult. ;-)


Have you tried it yet? Please let us know if you're successful.

 

Regards,
Matt

Link to comment
Share on other sites

Hi Matt,

I tried but its not working. For testing purpose i created a new group called "PageCount" and force the group to be printed on a new page  and expression i put

new Integer((int)($V{REPORT_COUNT}.intValue()/2))

for testing purpose i restrict no.of records per page as 2. dataset is retrieving 3 records from data base. but i am getting only 1 page report with only 1 record in a page. Please help me to resolve the issue.

i here by attaching report.jrxml file for your reference

thanks vans



Post Edited by neha prasanth at 04/13/09 01:22



Post Edited by neha prasanth at 04/13/09 07:47
Link to comment
Share on other sites

  • 4 years later...

Ok! Found a way to accomplish this!

 

The rows are usually printed in the Details band.

At the end of the details band, where you need a page break, add a pagebreak.

In the pageBreak's properties, edit the printWhen Expression from the properties pane.

The expression will be

 

new java.lang.Boolean((int)($V{REPORT_COUNT}.intValue())%10==0)

 

where 10 is the number of records per page.

 

This is how it is done in iReports. The jrxml equivalent for people directly editing the file is as below.

 

new java.lang.Boolean((int)($V{REPORT_COUNT}.intValue())%10==0)

Link to comment
Share on other sites

Ok! Found a way to accomplish this!

  1. The rows are usually printed in the Detailsband.
  2. At the end of the details band, where you need a page break, add a pagebreak.
  3. In the pageBreak's properties, edit the printWhen Expression from the properties pane.
  4. The expression will be

new java.lang.Boolean((int)($V{REPORT_COUNT}.intValue())%10==0)

where 10 is the number of records per page.

This is how it is done in iReports. The jrxml equivalent for people directly editing the file is as below.

<break>    <reportElement x="0" y="23" width="100" height="1">        <printWhenExpression><![CDATA[new java.lang.Boolean((int)($V{REPORT_COUNT}.intValue())%10==0)]]></printWhenExpression>    </reportElement></break>[/code]
Link to comment
Share on other sites

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