Oracle® HTML DB 2 Day Developer Release 2.0 Part Number B16376-01 |
|
|
View PDF |
A drill down report is a type of report that displays summary data with links to related detail data in a second report.
This tutorial describes how to create a report on the DEMO_ORDERS
table with links to drill down detail data in the DEMO_ORDER_ITEMS
table. Both tables are installed with the demonstration application, Sample Application.
This section contains the following topics:
Oracle HTML DB installs with a number of demonstration applications. To complete this exercise you must install the demonstration application, Sample Application.
To see if Sample Application is installed:
Log in to Oracle HTML DB.
Click the down arrow on the right side of the Application Builder icon.
From the menu, select Demonstrations.
The Demonstration Applications page appears, displaying links to the following applications:
Locate Sample Application and check the Status column:
If the Status column displays Installed, return to the Workspace home page.
If the Status column displays Not Installed, select Install in the Action column.
Follow the on-screen instructions.
First, create a new application.
To create an application:
From the Workspace home page, click the Application Builder icon.
From the Application Builder home page, click Create.
Select Create Application and click Next.
Specify the page name.
For Name, enter Drilldown Reports
.
For Application, accept the default ID.
For Create Application, select From scratch.
Click Next.
Next, you need to add pages. You have the option of adding a blank page, a report, a form, a tabular form, or a report and form. For this exercise, you will add two blank pages.
Add the first blank page:
Under Select Page Type, select Blank and click Add Page.
The page appears in the list at the top of the page.
Select the Name Page 1.
In Page Name, enter Orders
and click Apply Changes.
Add the second blank page:
Under Select Page Type, select Blank and click Add Page.
The page appears in the list at the top of the page.
Select the Name Page 2.
In Page Name, enter Order Items
and click Apply Changes.
Click Next.
For Tabs, accept the default, One Level of Tabs, and click Next.
For Copy Shared Components from Another Application, accept the default, No, and click Next.
For Attributes, accept the defaults for Authentication Scheme, Language, and User Language Preferences Derived From and click Next.
For User Interface, select Theme 2 and click Next.
Review your selections and click Create.
Next, you need to create reports for the DEMO_ORDERS
and the DEMO_ORDER_ITEMS
tables.
Topics in this section include:
To create a report on the DEMO_ORDERS
table:
On the Application home page, click Create Page.
For the page type, select Report and click Next.
For Page, select Wizard Report and click Next.
For Page Attributes:
For Page, select 1 Orders.
In Page Title and Region Title, enter Orders
.
Click Next.
For Tabs, accept the default, Do not use tabs, and click Next.
For Tables and Columns:
For Table/View Owner, select the appropriate schema.
For Table/View, select DEMO_ORDERS.
From the Available Columns list, press CTRL and move the following columns to the Displayed Columns list:
ORDER_ID, ORDER_TOTAL, ORDER_TIMESTAMP
Next, create a join with the DEMO_CUSTOMERS
table to display the customer name.
From the Table/View list, select DEMO_CUSTOMERS.
From the Available Columns list, select CUST_LAST_NAME and move it to the Display Columns list.
Click Next.
For Join Conditions, accept the join by clicking Next.
For Report Options, accept the defaults and click Next. Click Create Report Page.
Select Edit Application from the Developer Toolbar to return to Application Builder.
To create a report on the DEMO_ORDER_ITEMS
table:
On the Application home page, click Create Page.
For Page, select Report and click Next.
On Create Page, select Wizard Report and click Next.
For Page Attributes:
For Page, select 2 Order Items
.
In Page Title and Region Title, enter Order Items
.
Click Next.
For Tabs, accept the default Do not use tabs and click Next.
For Tables and Columns:
For Table/View Owner, select the appropriate schema and click Next.
For Table/View, select DEMO_ORDER_ITEMS.
From the Available Columns list, press CTRL and move the following columns to the Displayed Columns list:
ORDER_ITEM_ID, ORDER_ID, UNIT_PRICE, QUANTITY
Next, create a join with the DEMO_PRODUCT_INFO
table to display the product name.
For Show Only Related Tables, select No.
From the Table/View list, select DEMO_PRODUCT_INFO.
From the Available Columns list, select PRODUCT_NAME and move it to the Display Columns list.
Click Next.
For Report Options, accept the defaults and click Next. Click Create Report Page.
Run by page by clicking Run Page.
As shown inFigure 3-1, a report on the DEMO_ORDER_ITEMS
table appears.
Next, you need to customize the Order Items page. In this exercise, you add an item to hold the value of the ORDER_ID, add a condition that constrains the report by the value of ORDER_ID item, and modify the Region Title to note which order is being viewed.
Topics in this section include:
To create an item to hold the value of ORDER_ID:
Navigate to the Page Definition of page 2 by selecting Edit Page 2 from the Developer Toolbar.
Under Items, click the Create icon.
For Item Type, select Hidden and click Next.
For Display Position and Name:
For the Item Name, enter P2_ORDER_ID
.
For Region, select Order Items.
Click Next.
Click Create Item.
To add a condition to the DEMO_ORDER_ITEMS report:
Under Regions, select Order Items.
Select the Query Definition tab.
Click Add/Modify Conditions.
On the Conditions page:
From the Columns list, select ORDER_ID [DEMO_ORDER_ITEMS]
.
Enter the following in the Conditions field:
= :P2_ORDER_ID
Click Apply Changes.
Lastly, you link the DEMO_ORDERS report to the DEMO_ORDER_ITEMS report. To accomplish this, you edit the attributes of the ORDER_ID
column on the DEMO_ORDERS report and create a link. The link will populate the P2_ORDER_ID hidden item on page 2 with the clicked ORDER_ID.
To create a link from the ORDER_ID
column on the Orders report to the Order Items report:
Navigate to the Page Definition of page 1, Orders. Enter 1
in the Page field and click Go.
Under Regions, select Orders.
Click the Report Attributes tab.
Click the Edit icon adjacent to ORDER_ID.
Scroll down to Column Link:
In the Page field, select 2 Order Items.
From the Item 1 Name list, select P2_ORDER_ID.
From the Item 1 Value list, select #ORDER_ID#.
From the Link Text list, select #ORDER_ID#.
Click Apply Changes.
Click the Run Page icon in the upper right corner of the page.
As shown in Figure 3-2, you can link to page 2 by clicking on an Order Id.