How to use subreport in crystal report

how to use subreport in crystal report

Hi here is the solution by Seagate

Symptom

In Crystal Reports (CR) 8.5 and earlier, how do you suppress a section in the main report that contains a blank subreport?

For example:

A subreport is placed in the group header of the main report.

If the subreport does not return data, the group header still contains a blank space the size of the subreport.

Resolution

To suppress a section in the main report that contains a blank subreport, the following procedures must be completed.

Place the duplicate subreport into the section above the original subreport. For example, if the original subreport is contained in the group header of the main report, create another group header and place the duplicate subreport into it.

To insert a section into the report, complete the following steps:

1. In design mode, right-click the left gray margin where the subreport is located.

For example:

If the subreport is located in the group header, right-click the left gray margin at the group header level.

2. From the fly-out menu, select 'Insert Section Below'. You notice another section is inserted into the report labeled 'b'.

For example, by inserting another group header you notice that there is group header a and group header b.

3. Select the original subreport, drag and drop it into the second section.

4. Insert the duplicate subreport by selecting 'Subreport', from

the 'Insert' menu.

8. Click 'OK'. The duplicate subreport will be attached to the cursor.

9. Insert the subreport in the new section (such as group header b from step 2).

10. In the main report, on the 'Edit' menu click 'Subreport Links'. The top drop-down box will contain both the original and duplicate subreports. Compare these two subreports and enure that the fields in the 'Filed(s) to link to' box are the same. Also, check that the parameter in the bottom-left drop-down box and the field in the bottom-right drop-down box are the same.

Conditionally Suppressing a Section Containing Original Subreport

To conditionally suppress the section that contains the original subreport, complete the following steps:

1. From the 'Format' menu, select 'Section'. This launches the 'Section Expert'.

2. From the 'Section Expert' dialog box, select the section that contains the original subreport.

3. Click the 'X+2' button beside the 'Suppress (No drill down) check box. Ensure the checkbox is clear.

4. In the 'Format Formula Editor', create a formula similar to the following:

// variable Suppress is True

Whileprintingrecords;

Shared BooleanVar Suppress = True

Now when you preview the report, you notice that the sections that contain a blank subreport are suppressed. However, the section that contains the duplicate subreport is visible on the main report. In order to suppress the section still visible you must minimize and resize the section.

Source: www.crystalreportsbook.com

Category: Bank

Similar articles: