Crystal Reports subreports - crystal-reports

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.

Related

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

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.

Loop in Crystal Report to Evaluate Details Section Multiple Times

For simpler illustration of the problem, please refer the table below as the detail section part of the crystal report. This is the actual records in the details section part
In the group footer, below should be posted, what should reflect or be displayed in the group footer
Notes:
tenant2
tenant3
tenant5
tenant1
tenant4
Where in, the evaluation of the details section takes first those with "started remarks" to be followed by "ceased remarks" and displays their tenant name. It's like displaying the records in the details section in the footer with the order: Those with "started" remarks comes first.
As per the normal thing, using whileprintingrecords function, it will evaluate the report from top to bottom. Is this simple evaluation of records possible?
I currently used 3 way method formula in crystal report.

Crystal Subreport Common Headers

Maybe someone can Help me find the right technique.
I have a number of Crystal Reports that I am updating (Crystal Reports XI).
These reports each have an SQL Function associated with each that either retrieves records from the database (if any meet criteria) or returns an Empty Dataset (which happens daily).
These are executed in a batch process and directs the output to a PDF file which is emailed to users.
I am relatively new to Crystal Reports.
I am attempting to use a common SubReport to format/gather data for the Headers/Footers used in these documents. So far - most of this is working as I would expect. This allows me to use a single SubReport to generate the same Header/Footer in multiple reports (at least that's my goal).
However - I added a Report Footer section to the Main Report - my plan with this was to generate a Report Footer that would contain the following information:
A static Text Message that reads " --- END OF DOCUMENT ---"
The Report Title of the "Main Report"
The Date and Time that the Document was generated and Total Number of pages.
Sounds pretty simple.
So SubReport is named: "END-OF-DOCUMENT-SUBREPORT"
I used the "Special Fields" Data Date, Data Time, & Page N of M
Since the "Special Field" Report Title is returning me the "END-OF-DOCUMENT-SUBREPORT" value I used a Parameter field to pass the Report Title value from the Main Report to the SubReport.
This all works fine - HOWEVER - with the addition of the Linked Parameter Field from the Main to the SubReport - when I execute the report to generate the document - the SubReport ends up showing a blank Report Footer - that I can click on to reveal the "END-OF-DOCUMENT-SUBREPORT" in another Tab.
Without the Parameter field - it didn't do this and the information from the SubReport appeared on the last page of the document.
Is this a standard behavior of Crystal?
I'm not sure how to Suppress the "Drill Down" feature and still display the Report Section.
You can pass variable between you Main Report and sub Report. You can also create variable and assigned them to a sub report. As aMazing mention, creating Header and Report Footer sub report is not common. It is even messy. If you want something generic, I will create a report template that you will use in the future.
Have a good day!

Including a subreport into a GROUPING section

Crystal Reports: including a subreport into a grouping section?
asked the same question, but I am hoping a comment on the accepted answer is wrong: that it can't be done because the subreport must be in the details section. Also, what the selected answer says to do isn't working (perhaps because of the other detail, no pun intended).
So this looks like a duplicate question, yet the original question does not appear to be answered, and certainly the accepted "answer" is not usable by me.
(see also How to handle a duplicate question when the original has an accepted answer that is not really acceptable?)
My subreport can list one to many items, each of which can join to one or more items in the main report details. The common field they join on is the grouping item. So, for example, the subreport might have three items and the details five, but if I put it all in the details, I would have fifteen rows, with the first part repeated five times and the second part three times.
The common item appears as a "command field", a "report field". and the Group item. But no matter which of those I link as a subreport parameter, the subreport gets nothing and asks me to enter a value when I try to view the report.
In a more recent version of Crystal Reports you have two options: You can either connect the subreport to a value on the main report via the subreport parameter dialog. or you can pass a Shared Variable between the reports. If you are using the subreport parameter dialog, then the value passed in will be whatever that value is at the time the group is displayed. If the value comes from a detail in that group or from a variable on the main report it shoud pass fine. If the value is something that would be displayed after the group is displayed on the report (going top to bottom) then the value won't be written yet and will be passed to the report as null or blank.
Shared Variables are shared between a report and all of its subreports. If you need to get data from a subreport or pass a single value to multiple subreports, it might be the better option. If the shared variable is changed in the report or a subreport, it'll use the new value in everything after that.
SAP has a good guide on both techniques here:
http://scn.sap.com/people/ashish.bamzai/blog/2011/11/23/passing-values-between-reports-crystal-reports-2008
Bear in mind that Crystal Variables are always populated based on their position in the report and the order they are printed in. If something needs to happen after another group or subreport prints, you'll need to use the WhilePrintingRecords keyword.

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