Create a New Application

NOTE: This tutorial builds upon the masterdetail-detail report created in the previous section. You can either complete the previous tutorial or copy the rbMDD form from the RBuilder\Tutori-als directory.

1 Select File | New Application from the Delphi menu. This will create a new project and a blank form.

2 Close the new form and unit without saving.

3 Select File | Open from the Delphi menu. Locate the rbMDD.pas unit and open it.

4 Change the form name to 'frmDrillDownSubre-port'.

5 Select File | Save As from the Delphi menu and save the form under the name rbDrillD in the My RB Tutorials directory (established on page 181).

6 Select View | Project Manager from the Delphi main menu.

7 Right-click over the project name in the Project Manager (usually Project1.exe) and select the Add menu option. Add the rbDrillD form to the project.

8 Right-click over the project name in the Project Manager and select the Save menu option.

9 Save the project under the name rbDDProj in the My RB Tutorials directory.

NOTE: Save your work frequently to avoid losing changes should your computer unexpectedly lose power or crash.

Report Tutorials

Invoke the Report Designer and Configure the Drill-Down

1 Double-click on the Report component to display he Report Designer.

2 Size and move the Report Designer window so that the Object Inspector is visible.

3 Select the PageCount System Variable in the footer band. Set the variable type to PageNoDesc.

4 Select Report | Pass Setting | One Pass from the Report Designer main menu.

Drill-down reports should always be set to one-pass. Otherwise, the entire report will be generated each time the user expands the subreport.

5 Click the 'SubReportl' tab.

6 Place a shape in the left side of the detail band.

7 Configure the shape:

Name

ParentWidth Top Height Fill Color Line Color shpClickMe True 0

0.25

Yellow

Yellow

8 Right-click over the shape and select the Send to Back menu option. The shape should appear behind the other components.

9 Right-click over the Item subreport and select DrillDown.

NOTE: By specifying the DrillDown option of the subreport, we've associated the yellow shape with the report. Once we've done this, the subreport will not print until the shape is clicked in the Print Preview Window. The DrillDown... dialog sets the DrillDownComponent property of the SubReport.

11 Select File | Save from the Delphi main menu.

12 Preview the report. The items subreport should not appear. When you move the mouse over the yellow area, the cursor should change to a pointing hand. When you click the yellow area, the subreport should appear. Clicking the same area again should cause the subreport to disappear.

10 Select the shpClickMe from the drop-down list and click OK.

Report Tutorials

The report should look like this:

Initial View

Initial View

First three subreports expanded

File Edit View Report Help

First three subreports expanded

File Edit View Report Help

Design Preview |

Design Preview |

Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook


Post a comment