Oracle Reports Building Reports Release 6i A73172-01 |
|  | Contents | Index

# 3
Building and Applying Report Templates

The report described in this chapter is designed to help you learn more about the Report Builder features for building and applying templates.

About templates Templates define common characteristics and objects that you want to apply to multiple reports. For example, you can define a template that includes the company logo and sets fonts and colors for selected areas of a report.

In this report example, you will build a multi-query report that summarizes stock information by company symbol using the Tabular report style. You will create a new template and apply the template to the report. Then you will enhance the template by changing several default attributes in the template margin and body. You will enhance the template further by overriding some of the default attributes of the Group Above style. Finally, you will create an additional layout using the Group Above style, and re-apply the template to the report.

The following figure illustrates the concept of templates and the various features you will add to your template. A template defines the common look (the default attributes) of a report that can be applied globally across all report styles.

With the same template, you will change the look of a particular report style. In this example, you will override the default attributes of Group Above style.

When you create a report, you can use this template to apply a common look across many report styles (Tabular, Group Left, Matrix, and so on) or apply a unique look to a report with the Group Above report style.

Table 3-1, "Features demonstrated in this Templates sample report", describes the steps you will take to create a template and apply it to a report.

The following supporting files are used to help you complete the exercises in this chapter. They are located in your `ORACLE _HOME\TOOLS\DOC60\US\RBBR60` directory:

- `temp_hdrftr.htm`

- `oreplogo.gif`

- `osuplogo.jpg`

- `ostore.gif`

- `oracle.gif`

- `cconft.bmp`

- `cconfa.bmp`

- `t_image1.bmp`

- `t_image2.bmp`

- `temp.tdf`

- `temp.rdf`

You also will work with the following templates (located in your `ORACLE_HOME\REPORT60\ADMIN\TEMPLATE\US` directory):

- `corp2.tdf`

- `conf2.tdf`

You will work with the global preferences file, cagprefs.ora (located in your `ORACLE_HOME` directory.) The `temp.rdf` file contains the report you will create after finishing the tasks in this chapter. You may want to refer to this file while you are working. This file is located in your `ORACLE_HOME\TOOLS\DOC60\US\RBBR60` directory.

##### Table 3-1 Features demonstrated in this Templates sample report

Feature | Location
--- | ---
Create a multi-query data model and data links in the Data Model view. | Section 3.1, "Creating a data model"
Create a report using a pre-defined layout, and modify the layout in the Live Previewer. | Section 3.2, "Creating a report"
Create a new template, which will modify the appearance of your report, using the Layout Model view for templates. | Section 3.3, "Creating a template"
Add your new template to the pre-defined templates list in the Report Wizard so that you can apply it to your report. | Section 3.4, "Adding the new template to the predefined templates list"
Apply your new template to the report, and view the changes in the Live Previewer. | Section 3.5, "Applying the customized template to the report"
Change default attributes of the template that are applied globally to the body of the report. | Section 3.6, "Enhancing the default attributes of the template"
Override default attributes in the Group Above style of the template. | Section 3.7, "Overriding the default attributes of the template"
Create an additional default layout to illustrate the override attribute changes made to the template. | Section 3.8, "Creating an additional layout"
Make final format changes to the report. | Section 3.9, "Enhancing the look of the report"

To get started, open Report Builder. If the Welcome dialog box appears, click Build a new report manually and click OK. If not, choose File->New->Report. Click Build a new report manually and click OK. The Data Model appears.

At some point before you generate the report, you will need to log into the database. Choose File->Connect to connect to the database. Enter the appropriate log on information. See Section 1.3, "Obtaining database access before you start" for details.

## 3.1 Creating a data model

The steps in this section will help you create a multi-query data model. First, you will create two queries. Then you will create a break group for the first query. Finally, you will link the two queries.

### 3.1.1 Building two queries using the SQL Query tool

1. In the Data Model view, click .

2. Click in the Data Model view.

3. In the SQL Query Statement dialog box, enter the following query:

`SELECT ic.category,``SUM (h.sales),``AVG (h.high_365),``AVG (h.low_365),``AVG (h.div),``AVG (h.p_e)``FROM stock_history h,indcat ic`

    	WHERE h.symbol=ic.symbol
    	GROUP BY ic.category

``

1. Click OK. The query by default is labelled Q_1. You will change the query name in a later step.

2. Repeat steps 1 and 2 and enter the following code to create the second query:

       	SELECT	h.symbol,

`h.sales,`

    		h.high_365,
    		h.low_365,
    		h.div,
    		h.p_e,

`ic.category`

    	FROM stock_history h, indcat ic
    	WHERE ic.symbol=h.symbol

1. Click OK. The query by default is labelled Q_2. You will change the query name in a later step.

2. Choose File->Save As. Save the report in the directory of your choice, and name the report `temp_311.rdf`.

   Tip: It is good practice when you are designing your report to save it frequently under a different file name. If you generate an error or if you don't like some of the changes you made, you easily can go back to the previously saved file and make revisions from that point.

### 3.1.2 Renaming Data Model objects

In the Data Model view, make the following changes:

1. Click Q_1 and choose Tools->Property Palette.

2. Under the General Information node, set the Name property to Q_ind.

3. Repeat steps 1 and 2 for the following:

   ##### Table 3-2 Column name changes

   Old Name | New Name
   --- | ---
   G_category | G_ind_summary
   Q_2 | Q_detail

4. Save the report as `temp_312.rdf`.

### 3.1.3 Creating a break group

In this section, you will create a break group using the category column in the query Q_ind:

| For online help on this task, choose Help->Report Builder Help Topics On the Index page, type... break group, creating Then click Display to view help topic... creating a break group

1. In the Data Model view, drag the title bar of the group G_ind_summary down a few inches to make space for a new group.

2. Click and drag the category column above the G_ind_summary group to create a break group called G_category. The result will look similar to the following figure:

3. Save the report as `temp_313.rdf`.

### 3.1.4 Creating a data link

In this section you will create a data link between G_category and Q_detail.

| For online help on this task, choose Help->Report Builder Help Topics On the Index page, type... data link, creating Then click Display to view help topic... creating a data link

1. In the Data Model view, click .

2. Click the G_category group and drag a link to the G_symbol group. Your data model will look similar to the following figure:

1. Save the report as `temp_314.rdf`.

## 3.2 Creating a report

The steps in this section will help you create a default layout using the Report Wizard. You will create the default layout using the Tabular style. Finally, you will format several objects in the report using the Live Previewer view.

| For online help on this task, choose Help->Report Builder Help Topics On the Index page, type... default layout, about Then click Display to view help topic... About layout defaulting

### 3.2.1 Creating the default layout

1. In the Object Navigator, click for your report and choose Tools->Report Wizard. The Report Wizard appears.

2. On the Style page, click Tabular as the report style.

3. Click Next.

4. On the Groups page, click G_symbol from the Available fields list, then click Down. G_symbol moves to the Displayed Groups list.

5. Click Next.

6. On the Fields page, click symbol, then click to move the field into the Displayed Fields list.

7. Repeat step 6 for the following fields:

   - sales

   - high_365

   - low_365

   - div

   - p_e

   - category1

8. Click Next.

9. On the Labels page, change the labels and widths as shown in the following table:

   ##### Table 3-3 Labels and widths

   Column | Label | Width
   --- | --- | ---
   symbol | Symbol | 5
   sales | Sales | 6
   high_365 | High Stock | 6
   low_365 | Low Stock | 6
   div | Dividend | 6
   p_e | P/E | 6
   category1 | Industry | 6

10. Click Next.

11. On the Template page, click Corporate 2 from the Predefined templates list.

12. Click Finish. The Live Previewer appears. The report will look similar to the following figure:

13. Save the report as `temp_321.rdf`.

### 3.2.2 Formatting objects using the Live Previewer

You will format several objects in the report by changing the format mask to display numeric values as currency. Finally, you will right justify several objects.

1. With the report displayed in Live Previewer, click the column of data under the Sales heading to select it.

1. Click to add a dollar sign.

1. Click twice to add two decimal places.

1. Click to right justify the object.

2. Repeat steps 1 through 4 for the following:

   Tip: You can change several columns at one time: shift-click on all columns and choose Tools->Property Palette.

   - Column under High Stock

   - Column under Low Stock

   - Column under Dividend

   - Column under P/E

3. Shift-click the following objects, then click :

   - Sales

   - High Stock

   - Low Stock

   - Dividend

   - P/E

   The result will look similar to the following figure:

4. Save the report as `temp_322.rdf` , and close the Live Previewer.

## 3.3 Creating a template

The steps in this section will help you create a new template using the Template Editor Layout Model while in Edit Margin mode. First, you will open two templates, copy the Confidential watermark from one template and paste it into the other. Next, you will change the color of the Date label and add an HTML page footer to the template. Finally you will create a format trigger that will conditionally display graphics based on the page number of a report.

### 3.3.1 Creating a new template

1. Open the template `corp2.tdf` (located in your `ORACLE_HOME\REPORT60\ADMIN\TEMPLATE\US` directory). This is the Corporate 2 template that is currently applied to your report.

2. In the Object Navigator under the Templates node, click to select the CORP2 template. Then choose Tools->Template Editor to display the Layout Model view of the template.

3. Open the second template, `conf2.tdf`. This template contains a Confidential watermark.

4. In the Object Navigator under the CONF2 node, double-click the Layout Model node to display the Layout Model view of the template. Notice the rectangular box that spans diagonally across the template. This is the watermark.

   Tip: If you do not see the watermark, the Layout Model view might be displaying the Body.

   Click to switch between the Margin and Body. Alternatively, choose View->Layout Section. A check mark next to Edit Margin indicates the Layout Model view is in Margin mode.

5. Click the watermark, then click to copy the watermark.

   Tip: Every object in the Layout Model view is also represented in the Object Navigator. The watermark in the Layout Model view is represented as B_1 in the Object Navigator. To ensure that you have selected the watermark, arrange your workspace to display the Object Navigator and the Layout Model view side-by-side. Expand the CONF2, Layout Model, Section, and Margin nodes in the Object Navigator. When you click the watermark object in the Layout Model view, B_1 under the Margin node in the Object Navigator is highlighted. Your workspace should look similar to the following figure:

6. In the Object Navigator, click the CONF2 node, then choose File->Close without saving any changes.

7. Click the CORP2 node.

8. In the Layout Model view, click the title bar to make it active.

1. Click to paste the watermark into the template.

2. Save CORP2 as `cconf.tdf` in your `ORACLE_HOME\REPORT60\ADMIN\TEMPLATE\US` directory.

3. In the Layout Model view, click the Date label (the B_DATE1 object in the Object Navigator).

1. Click , then click a color.

2. Save the template again as `cconf.tdf`.

3. (Optional) Save the template under another name, such as `cconf_b1.tdf`, as a backup file.

   Tip: Backup files are useful when you are making significant changes to your template. If you don't like some of your changes, you always can go back to a previously saved template and make changes from that point.

4. If you saved the template as a backup, re-open the `cconf.tdf` template.

### 3.3.2 Adding an HTML header to the template

You will add an HTML footer to the template using the After Page Type and After Page Value properties.

| For online help on this task, choose Help->Report Builder Help Topics On the Index page, type... HTML output, about Then click Display to view help topic... About Web links for HTML output

For your convenience, this HTML footer file and its associated graphics have been provided for this exercise. These files are located in your `ORACLE_HOME\TOOLS\DOC60\US\RBBR60` directory. They are:

- `temp_hdrftr.htm`

- `oreplogo.gif`

- `osuplogo.jpg`

- `ostore.gif`

- `oracle.gif`

1. In the Object Navigator under the Templates node, double-click of the `CCONF` template to display the Property Palette. Under the Report Escapes node, set the following:

   ##### Table 3-4 Property changes to objects under the Templates node

   Property | Setting
   --- | ---
   After Page Type | File
   After Page Value | `c:\ORACLE_HOME\TOOLS\DOC60\US\RBBR60 temp_hdrftr.htm` (where "c" is the location of your `ORACLE_HOME`)

2. Save the template as cconf.tdf.

3. (Optional) Save the template under another name as a backup file, then re-open `cconf.tdf`.

### 3.3.3 Creating a format trigger

In this exercise, you will insert two boilerplate images in the margin of the template. Then, you will create a format trigger that will conditionally hide or show each of these images based on the page number.

| For online help on this task, choose Help->Report Builder Help Topics On the Index page, type... format trigger, description Then click Display to view help topic... Format trigger

Two images are provided for this exercise and are located in your `ORACLE_HOME\TOOLS\DOC60\US\RBBR60` directory. They are:

- `t_image1.bmp`

- `t_image2.bmp`

1. With the Layout Model view open, click to insert a linked file.

2. Using the ruler as a guide, click and drag the Link File object at the 7 inch marker, making the object about 1 inch square.

3. If necessary, click:

   - to set the object to no fill

- to set the object to no line

1. Double-click the Link File object to display the Property Palette.

2. Under the General information node, set the Name property to B_Image1.

3. Under the Link File Boilerplate node, set the following:

   ##### Table 3-5 Property changes to t_image1 object under the Link File Boilerplate node

   Property | Setting
   --- | ---
   Source File Format | Image
   Source Filename | `c:\ORACLE_HOME\TOOLS\DOC60\US\RBBR60\t_image1.bmp` (where "c" is the location of your `ORACLE_HOME`)

4. Under the Advanced Layout node, double-click Format Trigger property to display the PL/SQL Editor.

5. Type the following code in the editor. New code is displayed in bold:

       function B_Image1FormatTrigger return boolean is
       	F_pge number;
       begin
       	srw.get_page_num (F_pge);
       	If F_pge=1 then
       				return (TRUE);
       	Else
       			return (FALSE);
       	End if;
       end;

6. Click Compile.

7. If any compilation errors occur, check to code for syntax errors and recompile as needed.

8. Click Close.

9. Repeat steps 1 through 11 to insert the second image and set the following properties:

Under the General Information node, set the Name property to B_Image2.

Under the Link File node:

##### Table 3-6 Property changes to t_image2 object under the Link File node

Property | Setting
--- | ---
Source File Format | Image
Source Filename | `c:\ORACLE_HOME\TOOLS\DOC60\US\RBBR60\t_image2.bmp` (where "c" is the location of your `ORACLE_HOME`)

Under the Advanced Layout node, type the following code in the editor. New code is displayed in bold:

    function B_Image2FormatTrigger return boolean is
    	F_pge number;
    begin
    	srw.get_page_num (F_pge);
    	If F_pge=2 then
    				return (TRUE);
    	Else
    			return (FALSE);
    	End if;
    end;

Tip: Place the second image directly over the first image.

1. Save the template as cconf.tdf.

2. (Optional) Save the template under another name as a backup file, then re-open `cconf.tdf`.

## 3.4 Adding the new template to the predefined templates list

The steps in this section will help you add the new template to the predefined template list in the Report Wizard. First you will look at the Style and Template pages of the Report Wizard to gain a better understanding of how templates are applied to different report styles, such as Tabular and Group Above.

You will add template definitions to a global preference file, which defines the preferences for Report Builder.

Finally, you will apply the new template to your report.

| For online help on this task, choose Help->Report Builder Help Topics On the Index page, type... template, adding to predefined list Then click Display to view help topic... Adding a template to a predefined templates list

### 3.4.1 Viewing report styles and the Predefined template list in the Report Wizard

The following steps are an exercise to illustrate how templates are used in the Report Wizard. You will not make changes to your report in this section.

1. In the Object Navigator, click next to your report (last saved as `temp_322.rdf`), and choose Tools->Report Wizard.

2. On the Style page, click Form-like.

3. On the Template page. Notice the three options:

   - Predefined template list, a convenient way to select a template from a list and apply it to your report.

   - Template file, a way to apply a template to a report by specifying the template location and file name.

   - No template, an option not to apply a template to a report.

4. Choose Predefined template list, then click Corporate 1. Notice the sample graphic of the template style.

5. Go back to the Style page, and choose another report style.

6. Go back to the Template page. Notice that the sample graphic of the report style has changed.

   This is because, by default, a single template contains layout attributes for several report styles. You will learn more about the layout attributes of templates in a later step.

7. Cancel the Report Wizard without making any changes to the report.

8. Choose File->Close to close the report without saving any changes.

### 3.4.2 Adding the template to the Predefined template list

In the previous exercise, you learned that one template contains layout attributes for several report styles. To make the template available for a particular report style, you must add a template description and file name to Report Builder's global preference file. In the global preference file, you will define the template for the Tabular style and Group Above style so that they will be available in the Predefined template list in the Report Wizard.

1. In a text editor (e.g., Wordpad), open the global preferences file `cagprefs.ora` (located in your `ORACLE_HOME` directory).

   Tip: Most global preference changes can be made from Report Builder by selecting Tools->Preferences. For templates, however, you must add template definitions to the Predefined list using a text editor.

2. Scroll down or search for `Reports.Tabular_Template_Desc`.``

3. Add a new line and type "Custom Confidential", for the template name that will appear in the Predefined template list. See the bold text in the example that follows:

       Reports.Tabular_Template_Desc =
        ("Corporate 1",
         "Corporate 2",
         "Confidential Heading",
         "Confidential Background",
         "Custom Confidential",
         "Cyan Grid",

4. Scroll down to `Reports.Tabular_Template_File`.

5. Add a new line and type `cconf`, to identify the file name of the template. See the bold text in the example that follows.

   Tip: Be sure to place the file name in the same position as the description. For example, if you insert the template description in the fifth line under `Reports.Tabular_Template_Desc`, you must insert the template file name in the fifth line under `Reports.Tabular_Template_File`.

        Reports.Tabular_Template_File =
        (corp1,
         corp2,
         conf1,
         conf2,
         cconf,
         gngd1,

6. Scroll down to `Reports.BreakAbove_Template_Desc`.

7. Add a new line and type "Custom Confidential", for the template name that will appear in the Predefined template list:

       Reports.BreakAbove_Template_Desc =
        ("Corporate 1",
         "Corporate 2",
         "Confidential Heading",
         "Confidential Background",
         "Custom Confidential",
         "Cyan Grid",

1. Scroll down to `Reports.BreakAbove_Template_File`.

2. Add a new line and type cconf, to identify the file name of the template:

       Reports.BreakAbove_File =
        (corp1,
         corp2,
         conf1,
         conf2,
         cconf,
         gngd1,

3. Save the changes to the preferences file and close the text editor.

### 3.4.3 Displaying sample template images in the Template page of the Report Wizard

In addition to adding new templates to the predefined templates list, you can display a sample image when you select the template for a particular report style in the Templates page of the Report Wizard.

For your convenience, two bitmaps are provided for this exercise. These bitmaps must be located in the same directory as the template files.

1. Locate the following bitmaps (in your `ORACLE_HOME\TOOLS\DOC60\US\RBBR60` directory):

   - `cconft.bmp` for the Tabular style sample image

   - `cconfa.bmp` for the Group-above report style sample image

2. Copy them to your `ORACLE_HOME\REPORT60\ADMIN\TEMPLATE\US` directory.

   These bitmaps will display in the Templates page of the Report Wizard when you select the Custom Confidential template for the Tabular and Group Above styles. You will have an opportunity to view these bitmaps in a later step.

## 3.5 Applying the customized template to the report

The steps in this section will help you apply the new template to the report using the Report Wizard.

| For online help on this task, choose Help->Report Builder Help Topics On the Index page, type... template, applying to report Then click Display to view help topic... About applying templates

1. Close and restart Report Builder for the preferences to take effect. Connect to the database.

2. Choose File->Open to open your report (last saved as `temp_322.rdf`).

3. In the Object Navigator, click next to your report and choose Tools->Report Wizard.

4. On the Style page, click Group Above.

5. On the Template page, notice that the template, Custom Confidential, appears in the predefined template list.

6. Click Custom Confidential. Notice the sample graphic. It should look like the following figure:

   Tip: If the template does not appear in the predefined list, ensure that the template is in the correct directory (located in your `ORACLE_HOME\REPORT60\ADMIN\TEMPLATE\US` directory), and that the template description and file are correctly placed in the preferences file. If the sample graphics do not appear, ensure that `cconfa.bmp` and `cconft.bmp` are also located in the `ORACLE_HOME\REPORT60\ADMIN\TEMPLATE\US` directory.

7. On the Style page, click Tabular.

8. On the Template page, notice the sample graphic. It should look like the following figure:

9. Click Finish.

10. The report appears in the Live Previewer. Notice the following:

    - The report imported the template attributes to the report (i.e., the Report run on label changed colors).

    - The currency formatting and justification you made to the report were retained. Report Builder attempts to retain any manual modifications you make to the report when you apply a different template.

    - The confidential heading is hidden. This occurred because the frame fill pattern is set to solid. In a later step, you set the fill pattern in the default section of the template to transparent.

    - An image (i.e., the Oracle logo in black) is displayed in the upper right-hand corner of the report. Right now you can't check to see if the image changes based on the page number since this report generates only one page. In a later step, you will create an additional report layout that will generate a second page. At that time, you will see that the images change based on the page number.

1. Click to view the report in a Web browser and test the HTML header.

   Notice that the graphics are missing from the header. This occurred because Report Builder generates a temporary HTML file to your `ORACLE_HOME\REPORT60\TMP` directory. If you would like to preview this report with the header graphics, copy the following graphic files (located in your `ORACLE_HOME\TOOLS\DOC60\US\RBBR60` directory) to your `ORACLE_HOME\REPORT60\TMP` directory:

   - `oreplogo.gif`

   - `osuplogo.jpg`

   - `ostore.gif`

   - `oracle.gif`

1. Close the browser. Click again to disable the Web preview.

   Tip: When you are making a lot of little changes to your report, it is sometimes better to turn off the Web preview. Otherwise, the browser is constantly updating for each change that you make.

2. Save the report as temp_350.rdf and close the Live Previewer.

## 3.6 Enhancing the default attributes of the template

The steps in this section will help you enhance the Custom Confidential (CCONF) template even further. You will change some of the default attributes of the template, such as making objects transparent and changing the font style and color. These changes will be applied globally across all report styles in the template.

The changes you have made to the template so far have affected objects in the margin. The changes you will make to the default attributes will be applied to the objects in the body of the report such as frames, field labels, and fields.

### 3.6.1 Setting default attributes

1. Choose File->Open to open your template (saved as ).

2. In the Object Navigator under the Templates and CCONF nodes, double-click the Layout Model node to display the CCONF template in the Layout Model view. Ensure that the layout is displaying the Body. Click to switch between the Margin and the Body.

3. In the Object Navigator, expand the Layout Model, Section, Body, Default, and Frames nodes.

   Tip: When you select an object in the Object Navigator, it is selected in the Layout Model, and vice versa. Select the object you want to change in the Object Navigator and see the changes in the Layout Model view. You can work easily between these views by arranging your workspace to display the Object Navigator and the Layout Model view side-by-side. This technique is especially useful if you are new to editing in the Layout Model view.

4. Under the Frames node, double-click the Section Frame node. In the Property Palette under the Style node, change the Fill Pattern property to transparent.

   Tip: Click to display list of values. Click the value, then click OK to accept it.

5. Use the tables that follow to set the properties of the following objects:

   Tip: You can make these changes using the Property Palette. You can also change some properties (i.e., font and color) directly from the Layout Model view using the toolbar or tool palette.

   Under the Frames node, set the following:

   ##### Table 3-7 Property changes to objects under the Frames node

   Object | Property Palette node | Property name | Set to:
   --- | --- | --- | ---
   Headings Frame | Style | Foreground Color | another color from the tool palette, or specify darkblue in the Property Palette
   Fields Frame | Style | Edge Foreground Color | another color from the tool palette, or specify r0g88b75 in the Property Palette

   Under the Field/Labels Headings node, set the following:

   ##### Table 3-8 Property changes to objects under the Field/Labels Headings node

   Object | Property Palette node | Property name | Set to:
   --- | --- | --- | ---
   Character | Labels | Font | Bold Italic
   |  | Text Color | another color from the tool palette, or specify r0g88b75 in the Property Palette
   Number | Labels | Font | Bold Italic
   |  | Text Color | another color from the tool palette, or specify r0g88b75 in the Property Palette
   |  | Number Justification | End

   Under the Fields node, set the following:

   ##### Table 3-9 Property changes to objects under the Field/Labels Headings node

   Object | Property Palette node | Property name | Set to:
   --- | --- | --- | ---
   Number | Fields | Number Justification | End

6. Save the template as cconf.tdf.

### 3.6.2 Inheriting and localizing property values

The steps in this section are designed to help you understand a template's Inheritance feature. Inheritance determines the source from which property values are set. Default attribute properties inherit values preset by Report Builder until you change them. When you change properties, their values become localized (or contained within that template).

You can return a property back to its inherited value when you click (the Inheritance button) in the Property Palette. When a property value is inherited by its preset value, the icon next to the property in the Property Palette is a circle.

Default template property with an inherited value:

A property value becomes localized when you click (the Localize button) or change the value in the Property Palette. When a property value is localized, the icon next to the property in the Property Palette becomes a square.

Default template property with a localized value:

1. With the Layout Model view open, in the Object Navigator, find the Fields Frame object under the Frame node, double-click it to open the Property Palette.

   Under the Style node, notice that icon next to the Borders property is a circle, indicating that All is an inherited value.

2. Set the Borders property to Top Only. Notice that the icon changes to a square, indicating that the value is localized.

3. With the Borders property selected, click . Notice that the value returns to its inherited value.

4. Set the Borders property to Bottom Only.

5. Save the template as cconf.tdf, and close the Layout Model view of the template.

### 3.6.3 Applying changes to the template and viewing the results in Live Previewer

1. In the Object Navigator, click next to your report and choose Tools->Report Wizard.

2. On the Template page of the Report Wizard, click Custom Confidential, then click Apply.

3. In the Live Previewer, notice that none of your changes took effect (i.e., the watermark is still hidden). Report Builder retains the layout attributes in the report because you applied the same template to the report. Report Builder assumes, in this case, that the changes in the report take precedence over the changes in the template.

   Tip: When you are designing your template and want to continuously preview changes in a sample report, you can:

   - Delete all objects in the Live Previewer and apply the template by selecting the template in the Predefined template list on the Template page of the Report Wizard, or

   - Alternate between selecting the template from the Predefined template list and specifying the template file name on the Template page of the Report Wizard.

4. On the template page of the Report Wizard, click Template file, then Browse. Locate the template file `cconf.tdf` (located in your `ORACLE_HOME\REPORT60\ADMIN\TEMPLATE\US` directory).

5. Click Finish. The report will look similar to the following figure.

..

1. Save the report as `temp_360.rdf` and close the Live Previewer

## 3.7 Overriding the default attributes of the template

The steps in this section will help you override the default attributes in the template. You will override some of the settings for the Group Above style.

| For online help on this task, choose Help->Report Builder Help Topics On the Index page, type... template, Override Then click Display to view help topic... About template attributes

Tip: With the Property Palette open, click to return the selected property back to its inherited value, or click to localize the value.

Override attribute properties inherit their values from the template's default attributes. When a property inherits a value from the default attribute, the icon next to the property in the Property Palette is an arrow.

Override attribute property with an inherited value:

When a property is localized, the icon next to the property in the Property Palette becomes an arrow with a red cross through it.

Override attribute property with a localized value:

See Section 3.6.2, "Inheriting and localizing property values" for more information on inheritance for the template's default attributes.

1. Display the Layout Model view of the CCONF template. The template layout looks similar to the following figure. If it doesn't, the layout most likely is in Margin mode.

If necessary, click to switch to the Body of the template. Notice in the toolbar that the report style is Default. This layout defines the default attributes for the template.

1. Click Group Above from the Report Style drop-down list. The layout will look similar to the following figure:

2. In the Object Navigator, if they are not already expanded, expand the Layout Model, Section, Body, Override, and Group Above nodes.

   Notice that two sections (Level 1 and Level 2) are available. With these section nodes, you can override the default settings at the group level.

   Tip: If necessary, you can add more levels using the tool. For this exercise, however, you will maintain these two section levels.

3. Expand the Section (Level 1) node and the Section (Level 2) node. Under these nodes, you will change the attributes (i.e., headings, labels, and fields) for the specified group.

4. Double-click the Section (Level 1) node.

5. In the Property Palette under the Spacing node, set the following properties:

   ##### Table 3-10 Property changes to objects under the Spacing node

   Property | Setting
   --- | ---
   Inter-Frame (Horizontal) | 0.4
   Inter-Frame (Vertical) | 0.4

   Tip: Reviewing the changes in the Layout Model view might be more difficult when you are working with multiple sections. Some of the objects in the Layout Model view may be hidden behind other objects. The best way to review the changes made to the template is to apply it to your report and preview the report in the Live Previewer. For this exercise, however, you will make all the necessary changes first, then review the changes in a later step.

6. Use the table that follows to change the properties of the following objects under the Section (Level 1) node.

   Tip: You can make these changes using the Property Palette. You can also change some properties directly from the Layout Model view, such as the font and color of an object using the toolbar or tool palette.

   In the Frames node, set the following:

   ##### Table 3-11 Property changes to objects under the Section (Level 1) Frames node

   Object | Property Palette node | Property name | set to:
   --- | --- | --- | ---
   Headings Frame | Style | Fill Pattern | transparent
   Fields Frame | Style | Edge Pattern | transparent

7. Double-click the Section (Level 2) node.

8. In the Property Palette under the Spacing node, set the following properties:

   #####

   Property | Setting
   --- | ---
   Between Sibling Frames (Horizontal) | 0.1
   Between Sibiling Frames (Vertical) | 0.1

9. Use the tables that follow to set the properties of objects under the Section (Level 2) node. In the Frames node, set the following:

   ##### Table 3-12 Property changes to objects under the Section (Level 2) Frames node

   Object | Property Palette node | Property name | set to:
   --- | --- | --- | ---
   Headings Frame | Style | Foreground Color | another color from the tool palette, or specify r50g25b50 in the Property Palette
   Fields Frame | Style | Foreground Color | another color from the tool palette, or specify r88g100b75 in the Property Palette
   |  | Edge Pattern | transparent

   In the Field Labels/Headings node, set the following

   ##### Table 3-13 Property changes to objects under the Section (Level 2) Field Labels/Headings node

   Object | Property Palette node | Property name | set to:
   --- | --- | --- | ---
   Character | Labels | Font style | Bold Italic
   |  | Font size | 8
   |  | Text color | another color from the tool palette, or specify r88g100b75 in the Property Palette
   Number | Label | Font style | Bold Italic
   |  | Font size | 8
   |  | Text Color | another color from the tool palette, or specify r88g100b75 in the Property Palette

   :

   In the Fields node, set the following:

   ##### Table 3-14 Property changes to objects under the Section (Level 2) Fields node

   Object | Property Palette node | Property name | set to:
   --- | --- | --- | ---
   Character | Fields | Font Size | 8
   |  | Text color | another color from the tool palette, or specify r0g75b0 in the Property Palette
   Number | Fields | Font Size | 8
   |  | Text Color | another color from the tool palette, or specify r0g75b0 in the Property Palette

10. Save the template as cconf.tdf, and close the Layout Model view for the template. You will apply these changes to the report in a later step.

11. (Optional) Save the template as a backup, then re-open `cconf.tdf`.

## 3.8 Creating an additional layout

The steps in this section will help you create an additional layout using the Layout Model view. You will add the Group Above style to the main section of the report. Finally, you will apply the changes made to the template to your report and preview the results in the Live Previewer.

1. Display the Layout Model view of your report (last saved as `temp_360.rdf`).

2. Ensure that you are in the main section of the report.

1. Click to create an additional layout area.

2. Using the ruler as a guide, click and drag a rectangle at about the 2 inch marker to define the area of the layout. The Report Wizard appears.

   Tip: Click and drag the width of the logical page to ensure you have enough room to insert all the selected fields. The logical page is delimited by a solid black line in the Layout Model view. If you make the layout bigger than the logical page, you will get an error when you run the report.

3. On the Style page, click Group Above, and type the name of the report Stock Summary by Industry in the Title field.

4. Click Next.

5. On the Groups page, select the following groups and directions:

   - click G_category, then click Down

   - click G_ind_summary, then click Across

   - click G_symbol, then click Down

6. Click Next.

7. On the Fields page, click to move all fields to the Displayed Fields list.

8. Click category1 in the Displayed Fields list, then click . You should now have the following fields in the Displayed fields list:

   - category

   - SUM_h_sales

   - AVG_h_high_365

   - AVG_h_low_365

   - AVG_h_div

   - AVG_h_p_e

   - symbol

   - sales

   - high_365

   - low_365

   - div

   - p_e

9. Click Next.

10. On the Labels page, change the following columns as shown in the table

    ##### Table 3-15 Labels and widths

    Column | Label | Width
    --- | --- | ---
    category | Category: | 10
    SUM_h_sales | Total Sales | 6
    AVG_h_high_365 | Avg High Stock | 6
    AVG_h_low_365 | Avg Low Stock | 6
    AVG_h_div | Avg Dividend | 6
    AVG_h_p_e | Avg P/E | 6

    :

11. Click Next.

12. On the Template page, click Predefined template, then click Custom Confidential.

13. Click Finish.

    Tip: If the default layout region that you defined is too small, a message will appear asking if you want to extend the layout to the page boundaries. Click Yes.

14. In the Object Navigator, type M_G_CATEGORY_GRPFR in the Find field to locate this object. Note that the search occurs as you type, so you will most likely be taken to the object before you finish typing the entire name.

15. Choose Tools->Property Palette.

16. Under the General Layout node, set the Page Break Before property to Yes.

17. Click to view the report in Live Previewer.

1. Click to view the additional layout. The report will look similar to the following figure. Notice that logo in the upper right-hand corner of the report has changed to red.

2. Save the report as `temp_380.rdf`.

## 3.9 Enhancing the look of the report

The steps in this section are optional. They will help you enhance the look of the Group Above report. You will format the numeric values as currency.

Tip: If you re-enter the Report Wizard after making manual refinements in the Live Previewer, you will lose some of your changes when you click Apply or Finish in the wizard, and your layout will default back to the state defined by the wizard.

1. With the report displayed in Live Previewer, click the column next to the Total Sales heading.

2. Click .

3. Click once.

4. Repeat steps 1 through 3 for the following:

   - Column next to Avg High Stock

   - Column next to Avg Low Stock

   - Column next to Avg Dividend

   - Column next to Avg P/E

   - Column under Sales

   - Column under High Stock

   - Column under Low Stock

   - Column under Dividend

   - Column under P/E

   The report will look similar to the following figure:

5. Save the report as `temp_390.rdf`.

## 3.10 Summary

Congratulations! You have finished the Templates sample report. You now know how to:

- Create a multi-query data model with data links.

- Use a pre-defined template to create a report, and modify the report in the Live Previewer.

- Create a new template using the Layout Model view.

- Add templates to the Report Wizard.

- Apply templates to a report.

- Change the global default attributes of a template.

- Override default attributes of a template.

For more information about templates, see the online help:

| For online help on this topic, choose Help->Report Builder Help Topics On the Index page, type... template, about Then click Display to view help topic... About templates

| Copyright © 1999 Oracle Corporation. All Rights Reserved. |
|  | Contents | Index