Conditional Suppressing Detail section in Crystal Report - crystal-reports

There are 2 subreports in detail section of my report.
I have enabled suppress blank for subreports.
Now i want to suppress detail section if both subreports have no data i.e. both are suppressed.
I searched a lot on web but did not find a solution.

I'd first recommend against inserting subreports in the details section if at all possible because the subreport will be run for each record that the original report retrieves. If the report has 1000 rows it would be similar to running 1000 reports (thought not exactly).
That said, you have a couple of options.
You should be able to go into the section expert and check "Suppress Blank Section" for the Details section if you've already suppress the subreports.
If that does not work for you, you can create a formula field in each subreport that contains a shared variable that you populate the row count of the subreport. Then in the Suppress Formula (X+2 button) for the details section in the section export you can use those shared variables to enter a formula for the suppression of the section.
Here are a few links on using shared variables:
http://msdn.microsoft.com/en-us/library/ms225625(VS.80).aspx
http://books.google.com/books?
id=eukKHY9wjAEC&pg=PA316&lpg=PA316&dq=crystal+reports+passing+data+from+subreport&source=bl&ots=O8BzfeMJOK&sig=kt2v5JPbgy1bofCG6mFy4b5Qybk&hl=en&ei=wyKhSoWeHoqDngf4xZ35BA&sa=X&oi=book_result&ct=result&resnum=8#v=onepage&q=crystal%20reports%20passing%20data%20from%20subreport&f=false

Related

Create page header and details sections

I have created four database fields: ChargesView, CommodityView GeneralInfoView and LumpsumView
So I want ChargesView with header and its details, CommodityView with header and its details.
Ex:
I want crystal reports to be like:
Report Header
Page Header
Details
Pageheader
Details
Report Footer
Page Footer
As far as I know, you can't insert a PageHeader between 2 Details.
In this case, you have to use sub-reports.
Right click on DetailSection > Insert Sub-report > Choose an preexisting report or create a new one.
A subreport is a report item that displays another report inside the body of a main report.
Use subreports for the Details section
Write a subreport for ChargesView's Details section. Write another subreport for CommodityView's Details section. Place these subreports into separate Details sections for your main report, and activate New Page After for both sections.
If you need the Page Header to change based on which subreport is being displayed, you can make multiple Page Headers and suppress them based on a shared variable. (When your ChargesView section displays, set the shared variable to charges. Then have the Charges header only display when your variable is equal to `charges.)

Crystal report - displaying details and report header in a same row

I have a requirement in crystal report, where we have to show details section and report header together, so data will be displayed in a same row and according to the input the detail section can also grow in both direction row wise and column wise. Please use the sample picture for reference.
Is there any way to keep them together like in HTML where we can divide any table into one or more columns?
Any kind of information would be appreciated. Thank you.
In crystal it is not possible to add detail section in report header part..
How ever you can split detail section to multiple layout!!
1 - Right click report body then select Section Expert.
2 - Select multiple column.
3 - Then on layout you can provide detail size and gap detail.
Also you can insert multiple detail section and can swap inside the detail section. but not in report header part
It is possible for this purpose you need to use sub reports.
create a sub report and place in header section. Now limit the width of the sub report to the extent you need.
In sub report place the fields in details and supress rest all sections.
Now you can see header and details in report header..
Can you share along with sub report what you want to view in header?
You can use sub-report or setting up the section expert option.
Go to section expert
step 1: Suppress page header
step 2: At report header mark Underlay Following Section
Section Expert

How to suppress on-demand subreport in crystal reports?

In my report there is an on demand subreport. The subreport is sometimes empty and in these cases i want it to be suppressed (i.e. the caption should not be visible)
Is this possible?
I tried using the checkbox under subreport -> "suppress empty subreport". it doesnt work however.
Thanks
"Suppress empty subreport" will have no effect on an on-demand subreport - these are only run on demand, and until they have been run it is impossible to tell whether or not they will be empty.
If there is enough information in the main report to be able to tell whether the subreport will be empty - for example, if the subreport is a transaction breakdown and the main report includes the total transaction value, so that a total transaction value of 0 indicates that there will be no data in the subreport - then you can select Format Subreport in the main report section and conditionally suppress the subreport in the Common tab of the Format Editor dialog.

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.

Suppress Sections in Crystal Report

What is the use of suppress in Crystal Reports?
Is it possible to delete a section (page footer) in crystal report?
If yes, then what is the difference between Suppress and Delete?
Surpressing can be used in formulas, to allow the developer to surpress a section if a certain citeria is met. Or you can surpress the detail of the report if you wish to show a summary report.
You can surpress the page footer.
You can hide or suppress any section that you want. Hide allows for drill-down. Suppressing a section hides it and prevents drill-down.
Bare minimum, you need a report header, page header, details, page footer, and report footer sections. These can not be deleted.
You can additional sections of a given type by right-clicking the desired section and choosing 'Insert section below'. The name of the section will append a letter, starting at 'A' to the name to indicate multiple sections of the same type. If there are more than one section of a given type, then all but the last of these can be deleted.
Adding grouping adds a corresponding group header and footer sections. These behave the same way that I've discussed. Groups can be deleted.
Suppress leaves the section in the report. In addition, if you have formulas in that section that are set to execute WhilePrintingRecords, they will run, though they won't display results.
Delete a section means removing it from the report. Suppress a report means hide the section when viewing or printing the report. This is important when you want to only hide a section under some conditions.