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