1
votes

In my dataset I have multiple records, say 23. I want to print them line by line, every 23 lines in one page. Currently, my report has 23 pages and every page contain one record, which I don't want- I do want 23 lines in one page.

4
Have you set Print When expression PAGE_COUNT with any value?Ankit Srivastava
No, I haven't used anything, I know that detail band prints every record on separate page and Title prints only 1st record, which doesn't suits me. I know that I could use table (one table for every field I want from record), but I believe it have to be more efficient way to do this...burlicconi

4 Answers

0
votes

If you are using iReports then

Put a page break at the end of the details band and in the pageBreak's properties, edit the printWhen Expression from the properties pane as

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

Otherwise if editing the jrxml file directly then put this just after the <band> tag under <details> tag -

<break>
<reportElement x="0" y="23" width="100" height="1">
    <printWhenExpression><![CDATA[new java.lang.Boolean((int)($V{REPORT_COUNT}.intValue())%23==0)]]></printWhenExpression>
</reportElement>

Hope this will give you expected output.

0
votes

You shouldn't have to do anything special to get what you are looking for, Jasper Reports does what you are describing by default. There could be many things wrong with your layout, such as the detail band being too tall, some page breaks, or keep together set on a group or something.

I think you're better off spending some time creating a new simple layout using a tutorial such as this one (http://youtu.be/103MUpnyrvk) and hopefully you will see what you need to do to fix/recreate your report.

0
votes

What you could do is design the detail band so it displays one line the way you want it to display.

Next make sure the detail band wraps those fields. No whitespace above or below the textfield elements.

Next set the query of your report so that the requested data is extracted from your DB.

The detail band wil be repeated for every element in your dataset and thus display all records beneath each other without the whitespace.

0
votes

Increase the height of the Detail band until it's 1/23 times the size of pageHeight the other sections and margins.