Current state: Report book that prints 20680 pages
The issue: Report book is printing 98 times a report-element designated in the Content section (I've actually done the math)
Rundown:
Prototype_V2.jrxml (content report) --- report which has three subreports, all connected to the main by a single parameter
When compiled and run, this .jrxml produces 211 pages of various content, in other words, working 100% as the designer intended
Book_V3.jrxml (book report)--- latest "version" of the report book template (green wave template) that ought to incorporate a ToC (primarily) and cover pages (secondary)
I've tried:
Putting for some unearthly reason the content report inside the cover element of the book report. Result: only prints once, but ToC is all messed up.(It's indexing literally every page of the content report, therefore diminishing its' purpose)
Various report evaluation times for the content report inside the "Content" section. Result: Only on evaluation time "Report", does the element print, but it prints itself 98 times, 97 more than wanted.Otherwise, it won't even print.
I've tried, and failed to, add parameters between the Book and its' content report. For some reason, they just don't see each other at all.
I've tried giving the book report dataset empty rows, and not actual rows from the MySQL from which I'm getting the data, but then it won't print a thing. ("Document is empty" screen)
Cut out the subreports from the content report so I was left with a 6 page skeleton, and still the book report printed 98x6+3 pages. Ridiculous
The expectation:
Report Book with one page for front cover, as many pages as needed for ToC with proper grouping (and not linking from the ToC to each separate page of a report), ONE PRINT OF content report (which is already designed and tuned), and one page for back cover...
I know I haven't deliberately told the bastard to print one extra content report, much less 97 extra...
Issue resolved:
1. The 97 + 1 copies were produced because, unknowingly, I entered the same query for the book report as it is in the content report (98 is actually the number of unique groups my content report generated). Issue resolved with providing a KISS query of "select 1;" to the book dataset (because I'm not using the book for anything other than ToC and customization of cover pages)
((Why having the same query for book and content report produced a multiplication of this magnitude is still unknown to me, but the important thing is that it's no longer an issue))
2. ToC issue of every page being indexed resolved when I realized that content report generated a unique bookmark for every page of print, regardless of whether it is the first page of the subgroup or not.
Issue resolved with addition of a second text field underneath the first for both of my groups (of same size,color,font...) that has "print repeated values" flag checked off, and that second field being bookmarked and referenced.
This way content report still prints visually on every page both group names but the book report is referencing the "other" text field, that prints only on first occurence, for its' ToC.
Hopefully this will help someone in the future struggling with similar issues.
Related
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
So basically I have a report. I need this report to be printed as a 'set of reports'. Except that for each time the report is printed, there has to be a specific numbering at the bottom of the page. Where it would look something like this:
Page 1: Report + Page footer text 'Number 1'
Page 2: Conditions
Page 3: Report + Page footer text 'Number 2'
Page 4: Conditions
Page 5: Report + Page footer text 'Number 3'
Page 6: Conditions
And so on, for an undetermined amount of times..
In order to achieve this, I have created a main report, which currently contains 20 subreports, in order to achieve 20 pages (but I really I'd like this to be dynamical, maybe to be able to set the number of copies or something). Where each subreport consists of the single mentioned report (through the subreport 'Choose an existing report' option), with a custom text at the bottom.
The problem with this is that I can't maintain this. Every time an adjustment needs to be made to the original report, I will need to access 10 subreports and make the very same change or reload the report into this subreport.
What alternative ways of achieving my goal can you suggest, because this feels really 'dirty'. Thank you for reading.
I run Version 14.0.2.364 of Crystal Reports 2011
To achieve this, you need to use group and detail section in main report. For making adjustments with paging, each section has his own
page before
page after
reset page
So to help you a bit, you need to have your data in one datasource, and group by
Report/Conditions. For each group you can have only 1 subreport which will have link for that specific subreport (e.g. where barcod of smth is 1234) and there show your subreport data. For page number i would advise you to use my approach (for grouping) and then for page number you display group number (and that solves you all formulas for calculating pages).
If you are not familiar with grouping in Crystal, you can group your records in report by some fields by following image below
To summarize, try to define by which fields your reports has 20 subreports (probably some keys from database) and then group by that fields, examine advances of section expert and paging and you should be done in few hours making your report readable and easy to maintain.
Hope it helps
I am trying to generate a 'layered' Crystal Report using the Crystal Report plugin for Visual Studio 2015. I am having formatting problems and would like suggestions on grouping or formatting that will help me achieve something like the below image (what I am trying to achieve).
The first layer includes headers--the row beginning with Time of Search. There are multiple results for that section. I.e. Time of Search could have that 11/12 value pictured and an 11/14, 11/19...
The second layer returns a list of details associated with the first result. In fact, for this example there would be 187 results. My difficulty is that this second section has its own header as well. After printing the seconds sections details, I would like the first header to be displayed, followed by the first header's data, then second header, then second headers data.
There is no way I can know prior to generating the report how many section ones will be needed. Additionally, I do not know how many section twos will be associated with the given sections one. Any help is greatly appreciated!
This was achieved by using two groups and placing the Time of Search row in one group header say 1A. The details from that row were placed in group header 1B.
A second group say 2 contained the blue box row as its header. The list below was filled within the details area.
I have a report with two subreports. The first subreport is very short, the second one is quite long. I would like the exported spreadsheet to have a single sheet/tab for each of these two subreports.
In the main report's layout, the two subreports separated by a page break.
When I export (or just view the html in the browser), the page break appears after the first subreport, but the second one is then chopped into several more pages (because its very long).
Now I could make the main report a million pixels in height, but that would be an ugly hack making the first subreport appear with data in the first 10 rows and followed by thousands of empty rows.
How can I fix this?
(It is driving me mad.)
the report has a property called "Ignore Pagination" (iReport 4.0.2). If checked, it will print the whole document as a single page.
what is the equivalant command like in vb for EOF(), MoveNext, Moveprevious commands in crystal reports
There are no equivalent answers in Crystal Reports, at least not in the versions I have used. Crystal Reports more or less simply dumps the data out into the report.
That said, if you are in a detail row, and you want to find out what the next value of a field will be, you can use:
next({YourColumn})
You can also find out the previous column value by using this:
previous({YourColumn})
Keep in mind that Next() won't work on the last record, and Previous() won't work on the first record.
I'll have to double-check, but I believe there is an OnLastRecord function that returns TRUE if you are on the last record.
First, welcome to SO!
Second, you sound new to Crystal Report's purpose is to display data, not perform the kind of calculations you're talking about. CR usually goes record-by-record through the data, displaying (or suppressing) each record, and adding group headers & footers.
To answer your question, LittleBobbyTables does give a few good pointers. To see the entire list of functions available to you, there is a list in the Formula Editor (see pic below). Press F1 for detailed descriptions of each command.
You can also:
Create a "Running Total Formula" that will evaluate each record and give a calculation in the group footer.
Do the calculations outside of Crystal Reports and only feed the end result in (perhaps with an unlinked join to your primary table).
The most complex option is to make a subreport that does the calculation and feeds the result back to the main report
Can you give us some more details about what you're trying to do?