How to get a page per register stored in DDBB in jasperreports? - jasper-reports

I have a report with the following structure:
PAGE HEADER
DETAIL BAND (12 of those)
SUMMARY BAND
The detail bands show depending on expressions I specified. Also, the content of the detail bands are subReports, one per detail band (don't know if that is relevant or not here).
What I'm trying to achieve is to execute the report without any filter as the ID or any other field of the table. Instead, I want to extract the information of all the registers of one specific table (let's name the table USER).
What I'm expecting to find when I execute the report is something like the following:
PAGE HEADER
detail sections (shown depending on the expressions )
SUMMARY
What I'm getting looks similar to the following:
PAGE HEADER
DETAIL 1 (for user1)
DETAIL 2 (for user1)
DETAIL 1 (for user2)
DETAIL 4 (for user3)
and never the summary band (just at the end of the report)
As you can see, all the users are getting mixed while what I want to do is to start a new page for each one of them.
QUESTIONS:
How can I get the report to show each one of the users from the table
in separate pages?
Is there some property I missed that allows me to
do that?
Thanks!

I think I found a way to solve this challenge. I just made a group (Group1) based on the ID's of the users and put the content of my Page Header inside the Group Header just created. Did the same with the Summary band, put all it contents inside the Group Footer.
Then, selecting the Group Header (or the Group Footer) I checked the Keep Together and the Start New Page checkboxs from the Appearance tab.
Furthermore, for each one of the detail bands, selected the Group1 just created for the Group Changes selection combo in the Appearance tab.
I didn't do much testing yet but it seems like it's working as I wanted it to. If I find any other (better) solution I'll update the answer. Still open to hear advices though.

Related

Crystal Reports: how to repeat Details A section on every page

I'm creating a report in Crystal. It's a pretty basic report: I have two groups based on the same date field: year and month.
Those two groups serve as a way of organizing my details. I have the details hidden so they can be drilled down upon.
So when you first view the report, you just see the year(s) for group 1, and then the months for group 2.
If I wasn't using the grouped dates in this way, and was just creating a basic table, I would put the field headers in the page header section, which would automatically put the field headers on every page. However, since I have the grouped dates (hiding the details) on my first page, I can't put the field headers in there.
As a result, I created two detail sections (A and B). I put my field headers in A with the suppress formula (not onfirstrecord). This serves my purpose, but for when the report details fill up multiple pages, my Details A sections will only display on the first page.
Is there some formula or other way for me to:
1) Keep my field headers in Details A, but repeat the field headers on each new page?
2) or, move my field headers to the Page Header section, but somehow suppress it when my groups are being displayed on my main page (where the year and month groups can be drilled down on)?
Thank you!
You may want to use a repeated group header.
To do this open the Change Group Options dialog (right click on a group header, then choose Change Group). On the Options tab check Repeat Group Header On Each Page.
Put your headers for your detail section in a group header (maybe an additional one just for this purpose). Repeat this header on each page.
You can even detect if the header is printed the first time or if it is repeated using InRepeatedGroupHeader. This way you can implement a 'continued' on a repeated group header.

How to use a report as subreport (with additional info) multiple times in a maintainable way?

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

MS Access: Can a grouping be displayed on the left side of the detail section instead of above it?

Imagine a regular ol' report that has generated data and has one grouping level. We all know that grouping adds a section above the detail section and in here we can put in the controls that hold the grouped fields.
However, is there a way to display the grouped fields on the left of the detail section instead of above it? I know it's incredibly counter-intuitive because when you open up Access in design view, you don't have a place to put fields to the left of the Detail section - you can either put it inside or outside. But is this somehow possible?
I thought of using a subreport, but then the next question would be - how can I make the subreport generate data that lines up nicely with the data in the Detail section of the main report?
Is this possible?
Update:
Image of what Access currently does.
http://imgur.com/tbr8jz4
Image of what I'd like it to do.
http://imgur.com/WA9TbTI
Basically, I just want to show the stuff from the grouped section to the left of the detail section. It would not be repeated for each record.

How to use Details band to display multiple data sets

I have a JasperReports's report with 10 rows fetched from the main query..
When i run the report it will show 10 rows without a problem.
Now when i add another band with fields of a data set in a list item. It is repeated for every record in the main report!. :(
How can i avoid this situation and change the second details band to print when the main report data has finished printing on the first band?
I would want to achieve this without going for sub-reports as it's difficult to maintain many files for a single report.
I have learned a lot on jasper reports over time and I'm posting the answer for my very own question to help someone in future.
What you need to do is for complex, Multi-query reports you create the main report with a simple query like this.
SELECT SYSDATE FROM DUAL
What this means is that when it's run main report details band will have a single iteration. That means if we have used the SYSDATE field in the details band it will print once.
OK, now if you follow the following steps you should be able to achieve the above task successfully.
Add two details band to the report (you must be having one details band by default, to add another right click --> add another detail band)
Add two data-sets to the main report (right click on the report and select Add Dataset)
Now all you need to do is use those two data sets in the previously created details bands by using either a list item or table item (personally I would recommend table as you can do lot of advanced stuff in that)
Hope this will help someone in the future. let me know if you need more help!. Cheers!!

Crystal Reports subreports

Here is the scenario where I need help
I ve got a report - XYZ Summary Report (with embedded sub-report) and the XYZ Details report (the sub-report)
The requirement is that the XYZ Details report be a sub-report to XYZ Summary Report and also be available as a Stand Alone report through a Parameter.
Report Information:
1) A Parameter allowing the user to select the report they would like to run, either the XYZ Summary Report or the Agreement Details Report.
2) The XYZ Details Report should also be a sub-report to XYZ Summary Report which would allow the user to launch the XYZ Details Report through the XYZ Summary Report by selecting the linked Document Number.
I dont know if I am clear here. Let me know if you need more informaion
The combination of being able to drill down to the agreement details interactively, and being able to specify whether to run the report at detail or summary level makes this quite tricky - the former is implemented in Crystal using Hide functionality, while the latter requires conditional Suppression.
I recommend not doing the detail report in a subreport if you can avoid it - I find them awkward to develop and maintain. Additionally, due to the need to drill down interactively or at initial run-time, you will need to link to the subreport twice - once for the drill down, and once for the parameterised selection of the detail report. Consider linking the Documents table to the Agreement Details table, instead.
If you have to go down the subreport route, then:
Set up your parameter with an appropriate name (eg ReportType).
Group the main report by Document Number (if it isn't already) and place the detail items in the group header section, with the group footer section suppressed.
Split the details section of the report into two subsections.
Set the first details sub-section to Hide (Drill-Down OK) and add the subreport to it, with appropriate links on Document Number.
Set the second sub-section to be conditionally suppressed (in the Section Expert dialog) based on the value of the parameter, and add the subreport to it, with appropriate links on Document Number.
Alternatively, consider the method suggested by PowerUer, in the comments.