Active reports subreport multiple pge issue - activereports

I am using Active reports to generate a report.
The maiin report has 4 grids. For first 3 grids I am using sub reports and for the last grid , the main report is used.
Now the problem is if the records in sub report is spanning across multiple pages, the whole report is being displayed multiple times. However if the sub report has , say some, 20 records, the report displays each section just once.
FYI, in the details section I have an image which is supposed to be displayed only once when the report is run, followed by 3 grids ( 3 sub reports) and a grid(not a sub report).
In the report start event, am initialising the subreports like
subreport1 = new SubReport1();
In the report end event am disposing it like
subreport1 = null
and in the details_Format event of the main report, am
DetailedReport.Report = subreport1 ;
Please help me in resolving this issue at the earliest.

What other code do you have in the reports' events? This is almost certainly caused by changing some setting or changing the data/query in the subreports from an inappropriate event. All settings or changes made to the subreport should be done in the Format event of the section containing the subreport control.
Also, although not a problem in Detail_Format (assuming all your subreport controls are in the Detail section) you should be able to do the DetailedReport.Report = subreport1 and similar statements only once in the main report's ReportStart event. Probably no noticeable effect, but it should simplify the code slightly and remove the redundant SubreportControl.Report.set calls.

Related

my table jasper report repeat the data many time [duplicate]

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

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

Break Detail Line in Half?

Currently the detail prints like this:
I want to break the line in half like this:
This is what I have; Not what I want
Notes:
This is all in a sub-report if that makes any difference
I do not yet grok using formulas, variables, etc. to influence what is printed where, when, or how.
I'm working in Visual Studio 2012, I don't know the CR version.
I created Detail a and Detail b sections.
I created 2 Group Header Sections: Group Header 1a and Group Header 1b
I moved all the headers into these two groups and suppressed the Report Header Section (but not the Report Footer). Moved report fields into corresponding detail group.
Now all the detail is printed after both headers are printed. I expected this but don't know how to do what I need.
Totals are printed in the Report Footer, no issues here.
The Mystery is Solved
Created a 2nd sub report
Moved desired headings, details, and totals to the new sub report ReportHeadr, DetailSection, and ReportFooterSection respectively.
Put the new sub report directly below the original in the same (main report) section - it just happens to be a GroupHeaderSection
Changed SubReport Links ... for the new sub report. Set it identically to the original.
Notes
The sub report links setting is key to making this work. Otherwise I was getting all the data records every time this new sub report was generated, resulting in hundreds of pages.
Could not use Siva's answer. The sub report happens to be inside a Main Report's GroupHeaderSection. The report's structure does not make putting the (sub report) content into new groups and detail sections possible.
I did create multiple groups & detail sections in the sub report itself. This still gives me the undesired results illustrated in the original question posting.
if you need to view the output as you required follow below
1. Take 2 detail sections add two sub reports in main report.
2. In sub report 1 place first 3 columns and in second sub report place other two columns

crystal report, subreport details section not displaying the next batch of records

I put a subreport in the footer of my main report and I set its details section to display five records per page (through the paging tab).
I am sure my query returns nine records.
Upon previewing the report, on the first page, it displays the first five records.
However, on the second page, it also displays the first five records not the remaining four records.
I am not sure where is the problem since I just started using crystal reports. Hope you can help me. Thanks.
You need to set your sub report links.
This will link the data from your main report to your sub report. In Crystal 2008 you right click on the sub report and choose 'Change Sub report links...' option. Then you can select the data to flow from the main report to your sub report. Otherwise your sub report is being viewed as a completely separate report that you are just inserting on top of your main report and it will be the same at every instance.
Also, it might be a good idea to use groups instead of the details section when inserting sub reports.

Multiple unrelated in JasperReports

I am using iReport with JasperReports. I want to include multiple subreports that have unrelated sql queries. I would like to be able to put these all on one report.
The problem I am facing is that when I leave the master report sql query empty, none of my subreports have any data. There isn't really anything that the master report sends to the subreports since they are unrelated. Basically how do you throw multiple unrelated reports together into one report.
In order for the Detail Band to show, you will need to fill the main report query, even if its just a dummy query, like say:
SELECT 'a' FROM DUMMY
This will make the Detail band appear, and with it all the sub reports.
Otherwise, if you don't want to use the Detail Band, you have the option to view the other bands without using a query. From Edit menu, choose Report Properties, under More... tab, set the flag When no data to All Sections, no detail