Previous | Table of Contents | Next

Page 418

Figure 15.12.
Layout after reformat-
ting the objects.

Adding a Title, Date, and Page Count to the Report

Before you add a title to the report, be sure that there's enough space above the column headings for the title, date, and page count. To add the title, follow these steps:

  1. Select the Text Tool from the toolbar and, while holding the left mouse button, drag the area in which you want to enter the title—FLUGLE COLLEGE Course Catalog. Between FLUGLE COLLEGE and Course Catalog, press the Enter key so that FLUGLE COLLEGE appears above Course Catalog.
  2. To center the text in the box, select Format | Alignment | Center from the menu.
  3. Format the title so that FLUGLE COLLEGE is MS Sans Serif, Bold, 14 points and Course College is MS Sans Serif, Bold, 12 points.

To add the current date to the report, follow these steps:

  1. Select the Field Tool from the toolbar and, while holding the left mouse button, drag the area in which you want the date to appear.
  2. Double-click the field, causing a window to be displayed.
  3. Change the name of the field from F_1 to F_CURRENT_DATE.
  4. In the drop-down list labeled Source, select &Current Date.
  5. In the Format Mask, select Month DD, YYYY from the formats in the drop-down list (see Figure 15.13).
  6. Also, set the font for the date to MS Sans Serif, Bold, 10 points.
  7. Click OK for these settings to be used for the field.

Page 419

Figure 15.13.
Specifying the date for
the report.

To add the page number to the report, follow these steps:

  1. Select the Field Tool from the toolbar and, while holding the left mouse button, drag the area in which you want the page number to appear.
  2. Double-click the field, and a window labeled "Course: Layout Field - F_1" will be displayed.
  3. Change the name of the field from F_1 to F_PAGE.
  4. In the drop-down list labeled Source, select &Physical Page Number.
  5. In the Format Mask, enter NNN.
  6. Also, set the font for the page number to MS Sans Serif, Bold, 10 points. At this point, your report layout should look very similar to that shown in Figure 15.14.
  7. Click OK for these settings to be used for the field.

Testing the Report

It's time to test the report.

  1. Click the green light on the horizontal toolbar. You should see a window titled Runtime Parameter Form (see Figure 15.15).
  2. By default, the Destination Type for the report is set to Screen.
  3. Click Run Report. You will see a window—Report Progress—that displays the activity that is occurring on both the client and the server. After a short time, you should see the first page of the report as shown in Figure 15.16.
  4. Click Close when you are finished reviewing the report.

Page 420

Figure 15.14.
Current report layout.

Figure 15.15.
The Runtime
Parameter Formis
displayed.

Page 421

Figure 15.16.
First page of reportis
displayed.

Printing a Report

There are several ways to print a report. By default, the Runtime Parameter Form sets the report destination to the screen; in other words, the default behavior is that the user will see a report preview. You can create your own parameter form in which the default destination is the printer. However, even in preview mode, you can print a report by clicking the Print button.

Saving the Report

This is a good time to save your report. Like the Forms Designer, the Reports Designer can use the Oracle database as a repository. To save a module to the database, you or your DBA need to install the database schema needed by Developer/2000. To learn more about this, read the Administrative Notes that are in the Developer/2000 Admin for Win95.

However, for the examples in this book, save the reports to a file. To set this as the default in the Reports Designer, select Tools | Tools Options from the menu. In the Object Access group, there is a field labeled Storage Type. By default, it's set to File/Database. Select File from the drop-down list and click OK.

Page 422

To save this new report, follow these steps:

  1. Select File | Save As from the menu.
  2. Select the directory that you're using for storing your application-specific files.
  3. Enter Course for the File Name.
  4. Click OK. The Reports Designer will save a file named Course.rdf in the designated directory.

NOTE
The Reports Designer enables you to have multiple reports open simultaneously. You'll find this is a real convenience for copying objects from one report to another.

Building a Master-Detail Report

Another common type of report is the master-detail. An example of this is a report that lists each department and the instructors associated with the department. The Department table is the master record while the Instructor table is the detail record.

Creating a Data Model

To begin with, you need to create the data model for the report.

  1. Invoke the Data Model Editor by either clicking the icon to the left of the Data Model node in the Object Navigator or by selecting Tools | Data Model Editor from the menu.
  2. To create the master query, click the button labeled SQL on the toolbar on the left-hand side of the window.
  3. Move the mouse to the main part of the window and hold down the left mouse button, drag the mouse to the lower right, and release the mouse button. Double-click query Q_1.
  4. Change the name of the query to Q_DEPARTMENT.
  5. Click the button labeled Tables/Columns. Another window is displayed, titled Table and Column Names, enabling you to choose the table and columns used for the query.
  6. In the listbox labeled Database Objects, scroll down to the DEPARTMENT table and select it.
  7. Select each of the columns in the Columns listbox (see Figure 15.17).

Page 423

Figure 15.17.
Choosing the tables
and columns for the
master query.

  1. To use the selected table and columns in the query's SELECT statement, click SELECT-FROM and CLOSE. You'll see the SELECT statement that was constructed from the selected table and columns.
  2. Rearrange the column names so that they are in the order that you want to see on the report: Department_ID and Department_Name.
  3. Also, add an ORDER BY clause to the SELECT statement so that the rows will be ordered by Department_ID, as shown in Figure 15.18.

Figure 15.18.
Modifying the master
query's SELECT
statement.

  1. Click OK to return to the Data Model Editor. When you defined the SELECT statement for the query, the Reports Designer created a group for the master query—G_DEPARTMENT.

Previous | Table of Contents | Next

Используются технологии uCoz