JasperReports: Multiple sub-reports inside a master-report - jasper-reports

I would desperately need some help to achieve the following:
Create a master-report.jrxml, which includes a table of content and the corresponding sub-reports
These sub-reports all contain a different chart with different data query, which can be bigger than one page
Every page which includes a sub-report must show some static frame with dynamic content like the current sub-report's name and page X of Y
My approach so far was, to create a sub-report.jrxml for each of my required charts (I put chart in the sub-report's summary band). Then I created a MasterReport.jrxml with my static frame which included the sub-reports in the summary band. I expected/hoped that JasperReport would render a the according sub-report after each other, but it just overdraws on the same page.
How can I configure my report, to display the sub-reports after each other on new pages?
Any help with this, would be highly appreciated.

Try with subReports in a detail band and subRepport element has "Run to bottom" property which, if set to true, will make subReport take the whole page and push next item on a new page. There is also a page break element in JasperReports if "Run to bottom" doesn't work for you . For static content on each page use page header/footer bands.

Related

Passing Value from Sub Report To MainReport on Crystal Reports

I'm currently having a problem with regards on Crystal Report Shared Variable. this is my situation.
I have a Report consist of multiple sub reports (and of course the main report). i need to expose a value in main report from Sub Report, but the problem is i need to Display it before the sub report was rendered. Please see the image below:
As you can see the image above, i need to display the value below (Sub report with RED encircle with VALUE) on the TOP (Red encircle without value).
I used Shared Variable but i think it will not work since the TOP will be first rendered (where i need to display the Value from subreport) before the Below(where i need to get the value).
Is it possible?
The section that displays the value has already been rendered by the time the other section sets the value of the shared variable.
Two options:
add a second instance of the subreport to a section that precedes the section when you want to display its value; you won't be able to suppress either the section or the subreport, so you will need to make the subreport as small as possible and change the font colors to white
use a sql-expression field to calculate the desired value and avoid the subreport complexity altogether

JasperReports, PrintWhenExpression and RemoveLineWhenBlank → Strange Behaviour

I have a problem with JasperReports when using printWhenExpression and RemoveWhenBlank inside a subreport.
To reproduce this problem, I made a simple example using one master report and two subreport.
The first subreport, let's call it the static subreport, contains two Static Text components in the title band (Label 1 on the first line, Label 3 on the second), both have the Position Type attribute set to Float. The title band Split Type attribute is set to "Immediate".
The dynamic subreport have three Static text components (Label 1 on the 1st line, Label 2 on the second and Label 3 on the third), all of them have the Position Type set to Float. But Label 2 has PrintWhenExpression set to Boolean.FALSE and RemoveLineWhenBlank set to TRUE. So Label 2 is hidden and Label 3 is moved to Label 2's place under Label 1.
So basically the dynamic subreport and the static one have the same structure and should behave the same way when printed inside a report. But that's not the case in this little example.
In the master report I'm using a subreport component inside the detail band ( the split type of the detail band is set to Immediate ) and using a JREmptyDataSource with 90 empty rows. When pointing the subreport component to the static subreport, the pdf output generated by jasperreports is corrrect. But when using the dynamic subreport, jasperreports leaves an empty space (that is used when using the static subreport) at the end of the first page and jumps to the next page to print Label 3.
In the real case that I have a problem with, I have a subreport that contains more than 20 lines with Static Text and Text Field components, most to them with printWhenExpression set to a field or a parameter and RemoveLineWhenBlank set to TRUE. When producing the pdf output in some cases I have that specific subreport (which should occupy just  a third of a page) spanning one page and a half with a lot of space spread between the visible lines in the subreport. And I think the combination of RemoveLineWenBlank and PrintWhenExpression is what's causing the problem.
 
So what I want know is if this is a bug or just me missing something in the documentation.
Here is a link to the post I made at the JasperReports forum, it contains the templates for the master report and the two subreports, plus two pdfs generated by jasperreports and screenshots showing the layout of the subreports: link
Thanks in advance for your help.

Blank space at end of page

Background
A subreport with a column title and a detail section both set to 20px high.
When the subreport record displays on the main report, the subreport prints as expected until when it reaches at the bottom of the page.
Then the subreport prints just the column header and left blank space, then again starts on new page with column header and its detail.
Question
So, would you make it either print the whole subreport on same page, or start whole report from new page?
Master Report JRXML
http://pastebin.com/V2HRPWVL
Image of the problem faces
Thank You
Mihir Parekh
Another way to delete the last blank page that appears in the report, is eliminating the pagination of the report
Try set the Split Type of related band to Prevent. (Might be detail band)

Inserting a Page break into an SSRS report

I have a report in SSRS that contains 12 subreports. After each subreport, I need to insert a page break so that each subreport starts on a new page and doesn't share pages with the other subreports. Does anyone know how to do this? Thanks
I found an answer. Use a Rectangle at the bottom of each SubReport after all Tablixes and other rendering Objects. Then set its "PageBreak" property to "End". When the SubReport is finished with the Tablix and/or other data objects, the Rectangle forces a page break. Also, a cool feature, if the SubReport returns no rows of data, the page break is not rendered. Therefore, no extra page breaks
Another solution would be to have the subreports placed inside the rectangles. I would imagine this would help you to better control and organize the layout of the report.
I tried the other answer here but my master report is driven by a dataset so didn't quite work out. This is how I got it to work for me:
1) I put the subreports into different rows on top of same size rectangles inside a Tablix with all the rows belonging to the same row group.
2) I then selected properties of the group, then pagebreak and checked the property pagebreak on between each instance of group.
Just use the "Add page break after" on the General tab of Tablix Properties.
I came across the same kind of issue but I was able to overcome by below mentioned way.
I created a sub report and placed rectangle inside the sub report (page break option checked before) and placed all my sub report content inside the rectangle. This page break works only if the sub report renders any data if not they will be no page break.
I have made Many reports with a front Page Summary and Page 2 with the Detail.
Use the Tablix for the Page Break
Tablix > Properties > PageBreak > BreakLocation > Start / End / ......
Like other answers mention, I used the "Page break before" option on rectangles/tables, but for some reason it would only break the page if it wasn't at the very top of the (sub)report

New page in iReport

this is my situation:
I have a report with 10 (or more) items in detail area
I have a large text field that I would like to span across multiple pages (this text has nothing to do with items)
I am not able to create another page because all of my items fit nicely on the first page
How can I create (force) a new page to contain only some variable (static) text, on the page footer? In other words, how can I create a new page with no items?
In iReport Designer 4.1.1
The Break element is inside the Palette window.
You can select if you want to break the page or column
Palette > Report Elements > Break -> Page break.
Everything what is after this Break is printed on next Page.
Can you be specific about iReport version.
In 2.0.5, from the Edit menu choose "Insert page/column break"
Put it in the band where you want to break. In the Properties dialog, make sure the Break Type is set to "Page"
I usually prefer to use it with "Print with expression" so it does not make an empty page when i dont have an empty report already.
In 5.5.0
You can add large text field to the Summary band.
Then,click report name in Report Inspector find "Summary on new page" in Properties then check.
So you have new page after detail.
You can increase the page size of detail band in Ireport, To increase size go to xml tab
and search for
<detail>
<band height="482"/>
and add
<detail>
<band height="600" splitType="Immediate">
After that i think you may able to see another page.I have tested this method with only Summary band, if it does not work copy all the item in summary band.
You can use Break that you will get from Palette.
And if you want to add some text in the footer of second page only then you can't do it with the Brak only.
In that situation you need to use PrintWhen expression suits for your requirement.