Page 504
Figure 18.20.
Properties for the
Department_ID field
in the GroupHeader
area.
A Group area is used to "break" the report output. For this sample report, you want the report to "break" whenever the department changes so that a new column heading for department is printed.
Page 505
There is another property you may want to set for some reports: PageOnBreak. By default, this property is set to False, meaning that Oracle Objects will not go to the next page when there is a new value for Department ID. If you do want this behavior, set PageOnBreak to True.
Figure 18.21.
Properties for the
Department_ID field
in the GroupHeader
area.
You still need to add three objects to the Detail area: the course ID, the course title, and the course description. These will all be text fields. To add these three objects to the Detail area, select the Text Field button on the Object Palette, and add three text fields in the detail area.
Select the first text field, invoke its property sheet, and set these properties:
DataSource Course_ID Datatype String DrawStyle Standard Control HasBorder False Name Course_ID
Page 506
Select the second text field, invoke its property sheet, and set these properties:
DataSource Title Datatype String DrawStyle Standard Control HasBorder False Name Title
Select the third text field, invoke its property sheet, and set these properties:
DataSource Description Datatype String DrawStyle Standard Control HasBorder False Name Description
However, there are two other properties that you must specify for the Description field:
Close all the property sheets. At this point, your report should look much like the one displayed in Figure 18.22. Try testing the report by right-clicking Run Form. Figure 18.23 illustrates what the finished report looks like.
As you can see, the courses appear below the department that offers them. Also, notice that the Run-Time mode toolbar for a report is different from the Run-Time mode toolbar for a form. In the upper-left corner, there are two buttons that will go to the previous or next pages in the report. To exit Run-Time mode, click Stop on the toolbar.
Page 507
Figure 18.22.
Final report layout.
Figure 18.23. Page 508 As with forms, you can add a lookup field to a report. For example, suppose you want to
add a field to the Flugle College Course Catalog that indicated whether or not a course
was offeredin other words, whether or not it was in the Class table. To do this, add a text
field to the Detail area of the report. Invoke the property sheet for the new field. Set
these properties:
As shown in Figure 18.24, set the DataSource property to:
Figure 18.24. Let's examine this statement. The SQLLOOKUP function is used to execute a
SELECT statement against the Flugle database session. The
SELECT statement uses the DECODE function to
decode the value count(*), which is the number of classes that have the same value as the
Department ID and Course ID fields. If count(*) is equal to
0, the DECODE function will return null; nothing will appear in the report. If
count(*) is not equal to zero, this means that there
are
Page 509 classes offered for this department and course, and the
DECODE function will return the string Offered. Let's test the revised report. Click on Run Form on the toolbar. On the first page of the
report, scroll down to the courses offered by the Biology department. As you can see in Figure
18.25, BIO 101 is offered this semester.
Figure 18.25. In this lesson on Power Objects, you learned these important concepts:
Testing the report.
Adding a Lookup Field to a Report
Datatype String
DrawStyle Standard Control
HasBorder False
Name Offered
=sqllookup(Flugle,"select decode(count(*),0,null,'Offered') from Class
where Department_ID = `" + Department_ID.value +
Â"' and Course_ID = `" + Course_ID.value + "` ")
Setting the properties
for a report lookup
field.
Testing the lookup
field in the report.
Summary