简体   繁体   中英

How do I get a 3 page report in Jaspersoft iReport Designer 4.7

First of all: I've read this question but it is not working for me.

What I need: I have an SQL query that returns a 3 column set with about 50 rows that looks like this:

year | month | number
2012 | 1     | 35
2012 | 2     | 24
2012 | 3     | 127

and so on. Now I need two different representations of this data. The first one is a 2D bar chart and the second one a table with the numbers presented. I managed to do both, but what I'd like to have for the whole report is, to have 3 pages in total.

First page should be a simple cover page with the title of the report, which I can get by simply adding the title band, as far as I've understood. The second page should be the bar chart (filling the whole page) and the third page should be the table (also filling the whole page).

I've tried the following and didn't get the result I need:

  • Created 2 subreports (1 for bar, 1 for table), added them both in a main report (in the details band) with a page break in between. The result was 2 pages, but the chart and the table filled only half of their page. When I tried to resize the subreports to the full size of the page I got the error message that they're out of range...
  • Created 1 report with 2 detail bands. Added the chart into the detail band 1 and the table into the detail band 2. This worked for both elements to be the full size of the page, but the whole compiled report now has 100 pages --> 2 pages for one row in my sql set

So how can I accomplish what I need!? Is it even the right tool to use? Or should I simply create two reports, export them as PDFs and combine the PDFs by hand?

My suggestion - in your SQL query, add a fourth column that concatentates your year and month (let's call that year-month). Create a detail band with the following fields: year, month, number. Create a summary band for your chart with year-month as your x-axis and number as your y-axis. Make the title and summary bands the size of your output paper. In iReport, right-click on the name of your report and go to the Properties box for the report. Check the box for "Summary on a new page."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM