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
Related
Normally if we have report without any sub report in it, it is easy to print twice the report by adding same report in page footer as sub report . But if report contains already subreport than it is not possible to again add subreport in it. So how can we Print such report twice in crystal report.
It must exist a better solution, but here it goes two workarounds:
Alternative 1:
Turn your main report into a subreport (with its child subreport) and duplicate it in a brand new main report.
Advice: subreports use to perform poorly, but if your data is not large, it is ok.
Alternative 2:
If you can easily manipulate the data source (for example, if your generating a dataset through code), use the details section for your report, insert an extra table in your data source where the number of lines is the number of "copies" that you want to print. Let your main table join with this "fake" table without links. The result will be a cartesian product, so you will get the number of copies you want.
Extra note: Crystal let you use another rpt file as a subreport. Maybe you can use this feature to solve your problem. Personally, I don't like this feature, because it does not behave like I would expect by intuition.
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
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.
This question about crystal report.
I have crystal report, which has a formula in Group Section. I want to show all the generated group names in bottom of the crystal report.
So I have insert subreport to Main report footer. Then created a formula and link it to main report
formula.
But When running, in sub report, only show last generated group name only.
How to print all the generated group names in bottom of the report.
Thank you.
If I understand what you intend to do, you have a few options:
add a Cross-tab to the Report-Footer section - this will summarized the report's data without a second trip to the database
add a sub-report to the Report-Footer section - you will have more control of the formatting, but it will require a second trip to the database
create a formula that executes at print time (WhileReadingRecords) to store the group names in an array (note: arrays hold a maximum of 1000 entries), then create a second formula (also print time), that joins the array, adding it to the Report-Footer section.
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.