Note:  Image quality in this sample chapter has degraded as a result of the HTML conversion process.  Each volume of Learning Oracle contains clear and sharp images.


 Home

 Place an Order

 Related Links

Learning Oracle Reports 2.5

 

Chapter 3: A Break Report

 

You'll use the STK_HIST tabular report to create a break report. A break report suppresses duplicate data values, like the company name and stock symbol in the tabular report, so it's more readable. One good way to create break reports is to create a tabular report and then convert it to a break report.

If you still have the STK_HIST report open, skip the next few steps that open it.

Reusing A Report

1. Choose File, Open...

The Reports filter box opens.

                                                                        Undisplayed Graphic

 

2. Click on OK.

The Open dialog box opens.

                                             Undisplayed Graphic

The files listed are all Report Definition (.RDF) files, as you specified on the filter box. You can change directories if the file isn't in the directory listed.

3. Select the STK_HIST report definition.

4. Click on OK.

The Object Navigator replaced the UNTITLED report definition with the STK_HIST definition.

5. Choose File, Save As...

The filter dialog box opens.

6. Click on OK.

The Save dialog box opens.

                                           Undisplayed Graphic

7. Type into the entry field stk_brk.rdf.

8. Click on OK.

The Object Navigator shows the new name for the report.

                                                                 Undisplayed Graphic

Undisplayed Graphic9. Double-click on the Data Model icon under STK_BRK.

                                                           Undisplayed Graphic

The Data Model Editor opens with the schema for the STK_HIST report. The window banner shows STK_BRK as the current report.

Creating the Break

Your aim is to suppress the duplicate output of the company name and the stock symbol.

10. Click on the G_STK_HIST group box so handles appear around the group box.

                                                         Undisplayed Graphic

11. Drag the group box down a few inches so you have more space.

                                                              Undisplayed Graphic

12. Click on the COMPANY column to select it.

                                                           Undisplayed Graphic

13. Drag the column up (by holding down the mouse button and then moving the cursor) between the query label and the G_STK_HIST boxes, then release the mouse button.

                                                       Undisplayed Graphic

A new group, G_1, is created with the COMPANY column in it.

14. Select the SYMBOL column.

                                                      Undisplayed Graphic

15. Drag the SYMBOL column up to the G_1 group object and drop it below the COMPANY field                                                                                               Undisplayed Graphic

Resize the G_1 box so you can see both fields. Make sure the COMPANY column is above the SYMBOL column. Drag the COMPANY column up above SYMBOL if it's below SYMBOL.

16. Double-click on the G_1 box. Make sure you're in the G_1 box, not in a column name box.

The property window for group G_1 opens.

                                                    Undisplayed Graphic

When you create objects, Oracle Reports gives them default names. Names are formed by one or more letters that identify the type of object, such as Q for query or G for group, and a sequence number. You can leave the names like this, but for readability and ease of maintenance you should rename them to something meaningful. Once renamed, the sequence number for an object is reused by Oracle Reports. If you rename G_1 to G_BREAK, and then create another group, that new group will be named G_1 again.

17. Move to the Name entry field and type in G_BREAK.

                                                Undisplayed Graphic

Until you accept the change, both the Object Navigator and the Data Model Editor will show the old name.

18. Click on OK.

                                                     Undisplayed Graphic

By separating the two columns from the main group, you've created the break condition. You can't run the report until you've specified the default layout.

Default Layout

Undisplayed Graphic19. Click on the Default Layout icon on the upper Data Model toolbar.

20. Click on the Data/Selection tab.

A new group was added. Hierarchically it is above the G_STK_HIST group.

                                     Undisplayed Graphic

21. Click on OK.

The alert box asks if you want to replace the existing layout.

                                                      Undisplayed Graphic

22. Click on Yes.

The Layout Editor opens. The break columns are shown with a repeating frame separate from, but enclosing, the frame for the other columns. This means that for each value of company and symbol, all the data (trade date, number of sharestraded, and so forth) will be printed, then a new company and symbol will be output with its data.

             Undisplayed Graphic

 

Testing the Report

Undisplayed Graphic23. Save the report.

Undisplayed Graphic24. Run the report.

The Runtime Parameter Form opens.

25. Click on Run Report.

                                          Undisplayed Graphic

Replacing the Format Masks

The break worked, but the format masks you added to the tabular version of this report are gone. Replacing the existing layout has the unfortunate side effect of doing this. When working on a report, therefore, it's best to do all the layout first,then add format masks. (This may be a bug or a feature, but there's no logic to it. Unless you change widths on a field, for instance, there seems to be no reason for Oracle Reports to touch the format masks...)

26. Click on Close.

You should be in the Layout Editor.

27. Replace the format masks on the fields F_TRADE_DATE (MM/DD/YY), F_CURRENT_PRICE (NNN.N0), F_TODAYS_HIGH (NNN.N0), F_TODAYS_LOW (NNN.N0), and F_NUMBER_TRADED_TODAY (NNN,NN0). (Double-click on the field in the Layout Editor to open the Layout Field Property Window; or select multiple fields using shift-click, and choose Tools, Common Properties.)

Undisplayed Graphic28. Save the report.

Undisplayed Graphic29. Run the report.

The Runtime Parameter Form opens.

                                           Undisplayed Graphic

30. Click on Run Report.

The output shows the format masks and the breaks in the report.

31. Click on Close.

32. Choose File, Close to close the report.