Page header & footer on Summary band - jasper-reports

I have read this thread:
http://jasperforge.org/plugins/espforum/view.php?group_id=83&forumid=101&topicid=67923
I would rather not repeat the page header and footer for each crosstab, as there are six of them, and if the header needs to change, I'd like to change it only once.
The problems include:
Putting the crosstabs on their own page (should be easy enough with a page break).
Making the crosstabs include the same header and footer as the rest of the report.
Reusing the header & footer from a single source.
Making the crosstab be shown before the data (not all that important, but would be nice).
The report appears as follows:
It would be fantastic to have the crosstab appear on a page by itself, including the same header and footer as the rest of the report, rather than looking like the image above.
The report is set up as follows:
Any ideas?

The solution involved these changes:
Provide a dummy query for the main report (e.g., SELECT 1 FROM DUAL)
Create a new subreport for the data details, based on the former query for the main report
Add a second detail band (Detail 2)
Place the six subreports in the first detail band (Detail 1)
Place the data details subreport in the second detail band (Detail 2)
Pass the parameters from the main report into the data details subreport
Reduce the data details subreport's margins to zero
Delete the Summary band (no longer required)
This allows full control over the crosstab's report position while reusing the same header and footer for both the crosstab and the data details.

Related

Create page header and details sections

I have created four database fields: ChargesView, CommodityView GeneralInfoView and LumpsumView
So I want ChargesView with header and its details, CommodityView with header and its details.
Ex:
I want crystal reports to be like:
Report Header
Page Header
Details
Pageheader
Details
Report Footer
Page Footer
As far as I know, you can't insert a PageHeader between 2 Details.
In this case, you have to use sub-reports.
Right click on DetailSection > Insert Sub-report > Choose an preexisting report or create a new one.
A subreport is a report item that displays another report inside the body of a main report.
Use subreports for the Details section
Write a subreport for ChargesView's Details section. Write another subreport for CommodityView's Details section. Place these subreports into separate Details sections for your main report, and activate New Page After for both sections.
If you need the Page Header to change based on which subreport is being displayed, you can make multiple Page Headers and suppress them based on a shared variable. (When your ChargesView section displays, set the shared variable to charges. Then have the Charges header only display when your variable is equal to `charges.)

Crystal report - displaying details and report header in a same row

I have a requirement in crystal report, where we have to show details section and report header together, so data will be displayed in a same row and according to the input the detail section can also grow in both direction row wise and column wise. Please use the sample picture for reference.
Is there any way to keep them together like in HTML where we can divide any table into one or more columns?
Any kind of information would be appreciated. Thank you.
In crystal it is not possible to add detail section in report header part..
How ever you can split detail section to multiple layout!!
1 - Right click report body then select Section Expert.
2 - Select multiple column.
3 - Then on layout you can provide detail size and gap detail.
Also you can insert multiple detail section and can swap inside the detail section. but not in report header part
It is possible for this purpose you need to use sub reports.
create a sub report and place in header section. Now limit the width of the sub report to the extent you need.
In sub report place the fields in details and supress rest all sections.
Now you can see header and details in report header..
Can you share along with sub report what you want to view in header?
You can use sub-report or setting up the section expert option.
Go to section expert
step 1: Suppress page header
step 2: At report header mark Underlay Following Section
Section Expert

The subreport repeats itself in Detail band

I am new to JasperReports, basically I want to put a subreport in a mainreport
The problem is that I put the sub report in the Detail band, so when I query a database that has multiple data the subreport will always repeat itself multiple times when I output the report to a pdf. I want a report that does not repeat itself regardless of how many data I have in the database that i connect with
I have searched the Internet and the solutions is to add
new Boolean($V{REPORT_COUNT}.intValue()==1)
in the print when expression attribute of the subreport, that does solve a part of my problem due to the fact that now my subreport only prints once but it still leaves some blank pages after my subreport is displayed
So I assume it is still repeating itself but just doesn't print the data because of the expression that I added , people say that the nature of the detail band is supposed to work that way and that I shouldn't put the subreport in the detail band, but if I put it in some other band I get this error:
Error filling print... Subreport overflowed on a band that does not support overflow.
The error above will happen if I have a lot of data to the extent that it may take up more than a page.
How do remove those blank pages? If I am ask to not put it in a detail band then what should I do? or what solution are there?
The Detail band will be generated as many times as the number of records you have in your main dataSet(populated by the top-level query).
If you want to keep the subreport in the Detail band, which is normal by the way, you can do one of these things:
either have a dummy query that returns only one record, so that the Detail band generates only once. Then, pass the report connection to your subreport. You may have done that already. This way you can run your query independently of the main report.
or leave the report as-is and add your printWhen expression ($V{REPORT_COUNT}.intValue()==1) directly on the Detail band, not on the subreport. Please note that this is just an ugly hack that may affect the report performance. Your main query still returns a lot of data that you don't use so you should consider the other options.
If you can move the subreport out of the Detail band, place it in a band that allows overflow like Title or Summary band. Then:
have your main dataSet's query empty so that no Detail band gets generated
set whenNoDataType="AllSectionsNoDetail" at the report level(in the <jasperReport> tag) so that all the other sections except the Detail get generated
exactly as in the first option above, pass the report connection to your subreport and work from there

How to make detail band height fixed in Jasper Report?

I have two reports. One is used as sub report of other.
Sub-Report is placed in the detail band of main report.
I need to display a message at the end of the last page. For this message, I am using Last Page Footer.
But the problem is, I need to display the data in Tabular Form. Data coming from Sub report is dynamic, Because of this detail band height grows dynamically and I can not get the table lines aligned properly up to the last page footer.
Can anyone guide me a solution ?
Maybe I'm not getting your point, but if you need something as close as possibile to your last tabular data (not neccesarly at the end of the last page), why don't you use the Summary band instead of the LastPageFooter?
I hope to show you what I mean with this pic:
Is this what you would like to get?
If so, just use the Summary Band in the main report after your detail band

Issue with Column footer and Summary bands

I am creating invoices with JasperReports.
I have a Detail section that has the list of all items followed by a column footer which has Totals, Tax etc., and then the return policy in the Summary section.
I want to always ensure that the Detail is followed by Column footer followed by Summary bands. How can we ensure this? I found that sometimes the Summary comes before the Column footer.
Can someone throw some light on this?
There really is not much of a solution to this at the moment as it seems to be by-design and not a bug (personally I think they should have an option for this). Your options at the moment though are:
Create a Report Group (this is essentially a dummy report group,
doesn't really matter). Move your Column Footer contents into the
Group Footer band, and leave your Summary in the Summary band.
This seemed to work in my limited tests, and I would try it first.
Set Float Column Footer and Summary on new Page to true under the
main report properties. This has the unfortunate side effect that the
summary will always be printed on a second page regardless if
everything could fit on one.
Set Float Column Footer to true and move your Summary section to
the Last Page Footer band. This means it will only be printed once,
but the content will be oriented towards the bottom of the last page.
Edit: For the shed some light on this part of the question. It is by design. The Column Footer is seen/treated as essentially a specialized Page footer. So body content (detail band, summary band, etc.) are placed on the page above it always. The only time it does not seem to happen is when the summary is printed on a new page, after the last Column Footer has been printed. So it is by design.
I've been looking for answers to this silly formatting question for hours, and I think I might have found a useable solution:
move your Column Footer content to the Page Footer and,
create a Last Page Footer but set its width to 1 pixel with no content inside
This allowed me to have some borders/subtotals at the bottom of every column, whilst ignoring the footer-before-summary/total-before-subtotal problem on the last page because the Last Page Footer overwrites the Page Footer (summary) content.
Add a last page Footer , in that add the content of your column footer after that increase band width and add the summary content into that(last page footer) and remove the content from the summary band.