|Oracle® Application Express Advanced Tutorials
Part Number E13363-02
This tutorial provides an introduction to Application Express report types, illustrates how to create a parameterized report, and demonstrates how the user can dynamically manipulate the interactive report format.
This tutorial contains the following topics:
In an Oracle Application Express application, a report is the formatted result of an SQL query. A parameterized report is a dynamic report based on input from the application user or another component in the application. The application user enters search criteria which is used to generate the report. For example, the user may want to see all issues assigned to a particular person. The user inputs the person's name into the Search Bar and requests the report. The report is generated based on the name provided by the user.
In this tutorial, you create an interactive report page based on an SQL query of a table of issues. A form page is also created and is used to modify, remove or create issues. The interactive report features allow the user to customize the focus and formatting of the report.
This section describes the basic Application Express report types, and explains how to know which one is best for your application.
This section includes these topics:
There are two basic types of reports, an interactive report and a classic report.
The interactive report is the default report type when creating an application, converting forms, and creating pages. Interactive reports enable the user to perform a variety of report customizations. Unless disabled by the developer, an interactive report includes the ability to perform searching, filtering, sorting, column selection, highlighting, and other data manipulations. For a complete list of capabilities and how to use them, see "Using an Interactive Report". See Figure 3-1 for an example of an interactive report that queries the IT_PEOPLE table and was created using the Create Page Wizard.
Notice the automatically built in Search Bar, Column Heading Menu links, and Link Column icons in the first column of each row. For a complete description of each of these components, see Introducing Interactive Report Components.
A classic report does not by default include any of the interactive report customization features. See Figure 3-2 for an example of a classic report that was built with the Create Page Wizard and queries the same columns in the IT_PEOPLE table as the interactive report in Figure 3-1 queries.
Notice there is no search bar, no column heading links and no drill down capability.
If you want user customization capability such as search, filtering and sort controls, select an interactive report. You can tailor the customization options available to the user by enabling and disabling the individual options. If your report does not need such controls you should consider a classic report. Classic reports also have integrated tabular form capabilities that allow declarative grid update.
In this section, you create an application using the Create Application Wizard and then run the application. When you finish this section, your application will have a Home page, Issues report page, and a Issue Details form page similar to Figure 3-3, "Home Page", Figure 3-4, "Issues Report", and Figure 3-5, "Issue Details Form".
This section contains the following topics:
Before you begin creating the application, you need to create the appropriate sample objects within your workspace and load them with demonstration data.
To install the Issue Tracker sample objects:
Create the Issue Tracker data objects. Follow instructions outlined in "Create and Run a Script to Build Database Objects" .
Load objects with demonstration data. Follow instructions described in "Loading Demonstration Data" .
These sample objects are copies of the Issue Tracker application objects. For a complete description of the Issue Tracker application see Chapter 14, "How to Design an Issue Tracking Application" and Chapter 15, "How to Build and Deploy an Issue Tracking Application".
The Create Application Wizard creates the Home page, Issues report page, and Issue Details page. Because you are creating an interactive report, the wizard automatically includes a Search Bar, Actions Menu, Column Heading Menu, and a link from the Issues report page to the Issue Details form.
See Also:For detailed information on how to use these interactive report components refer to "Using an Interactive Report". For information on how to configure these components, see "Editing Interactive Reports" in the Oracle Database Application Express User's Guide, "Building Your Application" in the Oracle Database 2 Day + Application Express Developer's Guide,
To create an application using the Create Application Wizard:
On the Workspace home page, click the Application Builder icon.
The Application Builder home page appears.
Select Create Application and click Next.
For Name, specify the following:
Name - Enter
Application - Accept the default.
Create Application - Select From scratch.
Schema - Select the schema where you installed the OEHR sample objects.
Next, add a blank page.
Under Add Page, specify the following:
Select Page Type - Select Blank.
Page Name - Enter
Click Add Page.
The new page appears in the list at the top of the page.
Under Add Page:
Select Page Type - Select Report and Form.
Subordinate to Page - Select Home (1).
Table Name - Select IT_ISSUES.
Implementation - Accept default of Interactive.
Click Add Page.
The It_Issues Report link and It_Issues Form link appear in the Create Application region.
Next, you change the name of the report and form from the default names.
Click the It_Issues link next to Report at the top of the page.
Under Page Definition, enter
Issues for Page Name.
Under Report Columns, for Show select No for these columns:
Click Apply Changes.
Click It_Issues link next to Form.
Under Page Definition, enter
Issue Details for Page Name.
Click Apply Changes.
The Issues Report link and Issue Details Form link appear in the Create Application region.
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 all defaults and click Next.
For User Interface, select Theme 18 and click Next.
A theme is collection of templates that define the layout and style of an application. You can change a theme at any time.
See Also:"Managing Themes" in Oracle Database Application Express User's Guide
Review your selections and click Create.
The Application home page appears.
Next, you run the application and navigate from the Home page to the Issues report and then to the Issue Details form.
To run the application:
Click the Run Application icon.
Enter your workspace login information.
The Home page appears.
Click the Issues link.
The Issues Report displays.
For the first row, click the Edit icon.
The Issue Details form appears as shown in Figure 3-8.
The Create Application Wizard configured the Issues interactive report Link Column to target the Issue Details form. This is the default when the wizard creates a page type of Report and Form.
Tip:The Link Column can be reconfigured by going to the Report Attributes page and changing the Link Column setting. See Introducing Interactive Report Components.
Click Cancel to go back to the Issue Report.
Click the Create button.
An empty Issue Details form appears. This form enables you to add an issue to the IT_ISSUES table. At this point, do not create a new issue.
Click the Application ID link on the Developer toolbar at the bottom of the page.
Next, you add columns of data from the IT_PEOPLE and IT_PROJECTS tables. When you created the Issues report page with the Create Application Wizard, only data from the IT_ISSUES table was included in the SQL query. To add data in this report from tables other tables, you modify the Issues report SQL query and then use the Actions menu to include the added columns in the report.
To change the SQL query:
Click the 2 - Issues page.
Under Regions, click Issues.
For Source, replace with the following SQL:
SELECT "IT_ISSUES"."ISSUE_ID" as "ISSUE_ID", "IT_ISSUES"."ISSUE_SUMMARY" as "ISSUE_SUMMARY", "IT_PEOPLE"."PERSON_NAME" as "IDENTIFIED_BY", "IT_ISSUES"."IDENTIFIED_DATE" as "IDENTIFIED_DATE", "IT_PROJECTS"."PROJECT_NAME" as "PROJECT_NAME", decode("IT_PEOPLE_1"."PERSON_NAME",NULL,'Unassigned', "IT_PEOPLE_1"."PERSON_NAME") as "ASSIGNED_TO", "IT_ISSUES"."STATUS" as "STATUS", "IT_ISSUES"."PRIORITY" as "PRIORITY", "IT_ISSUES"."TARGET_RESOLUTION_DATE" as "TARGET_RESOLUTION_DATE", "IT_ISSUES"."PROGRESS" as "PROGRESS", "IT_ISSUES"."ACTUAL_RESOLUTION_DATE" as "ACTUAL_RESOLUTION_DATE" FROM "IT_PEOPLE" "IT_PEOPLE_1", "IT_PROJECTS" "IT_PROJECTS", "IT_PEOPLE" "IT_PEOPLE", "IT_ISSUES" "IT_ISSUES" WHERE "IT_ISSUES"."IDENTIFIED_BY_PERSON_ID"="IT_PEOPLE"."PERSON_ID" AND "IT_ISSUES"."ASSIGNED_TO_PERSON_ID"="IT_PEOPLE_1"."PERSON_ID"(+) AND "IT_ISSUES"."RELATED_PROJECT_ID"="IT_PROJECTS"."PROJECT_ID"
Click Apply Changes.
Click Apply Changes to Confirm.
To display the new columns:
Click the Run Page 2 icon.
Click the Actions menu as shown in Figure 3-9.
Select the Select Columns option.
The Select Columns options appear showing the Identified By, Project Name and Assigned To columns in the Do Note Display box. When you modify the query and columns are added, they do not appear in the report automatically and need to be added.
Use the Move All arrows (>>) to move all columns from the Do Not Display box to the Display in Report box.
Select the Issue Id column in the Display in Report box and click the Remove arrow (<) to move it to the Do Not Display box.
Using the up and down arrows to the right of the Display in Report box, reorder the columns as follows:
Target Resolution Date
Actual Resolution Date
The Issue report appears with the new columns.
This section introduces the basic interactive report components then teaches you how an application user can manipulate these components to customize an interactive report. Only some of the most common customizations are shown in this section. For a detailed description of how to use each feature, see "Editing Interactive Reports" in the Oracle Database Application Express User's Guide .
Topics included in this section:
This section provides a basic understanding of interactive report components and terminology.
In Figure 3-12, the basic interactive report components are identified in red font:
Unless disabled by the developer, the following components are by default included on an interactive report page:
Search Bar - Displays at the top of each interactive report page. Provides the following features:
Select columns icon looks like a magnifying glass and enables you to identify which column to search (or all).
Text area enables you to enter case insensitive search criteria (wild card characters are implied).
Rows selects the number of records to display per page.
Go button executes the search.
Actions Menu icon displays the actions menu.
Actions Menu - Used to customize the display of your interactive report. Provides the following options:
Select Columns specifies which columns to display and in what order.
Filter focuses the report by adding or modifying the
WHERE clause on the query.
Sort specifies which columns to sort on and whether the order is ascending or descending.
Control Break creates a break group on one or several columns.
Highlight enables you to define a filter and highlight the rows that meet the filter criteria.
Compute enables you to add computed columns to your report.
Aggregate enables users to perform mathematical computations against a column.
Chart adds a chart to your interactive report.
Flashback performs a flashback query enabling you to view the data as it existed at a previous point in time.
Save Report saves the current customized report settings so they can be used in the future.
Reset enables you to reset the report back to the default report settings.
Help provides detailed descriptions of how to use the interactive report components to customize your reports.
Download enables the current result set to be downloaded.
Column Heading Menu - Clicking on any column heading exposes a column heading menu that enables you to change the sort order, hide columns, create break groups on a column, view help text about the column and create a filter.
Report Settings - If you customize your interactive report, the report settings are displayed below the Search Bar and above the report. If you save customized reports, they are shown as tabs.
Link Column - This column links to a Single Row View or to a Custom Target. In this particular interactive report, shown in Figure 3-12, "Interactive Report Components", the link column is a Custom Target, displayed as an Edit icon, that links to the Issue Details form enabling the user to view and modify the selected issue information.
The Link Column is specified by the interactive report's Link Column setting on the Report Attributes page. There are three possible selections for this setting:
Link to Single Row: This option enables the user to view details for a single row. The Single Row View enables the user to view data, not modify it. Link to Single Row is the default setting when creating an interactive report of page type Report. See the Issues interactive report page created in Chapter 4, "Using Advanced Report Techniques" for an example.
Link to Custom Target: This option enables the user to go to another page in the application or to a URL, depending on which target was specified by the developer. Link to Custom Target is the default setting when creating an interactive report of page type Report and Form. The target defaults to the form page where the user can modify data for that row. The Issues interactive report in this application is an example of this type of link.
Exclude Link Column: This option removes the Link Column from the interactive report.
Next, you examine some of these features to customize the appearance of your report and specify what data to include.
In this section, you add a filter to the report from the Search Bar. The filter displays all issues assigned to Carla. Keep in mind, however, that there are other ways to add a filter to your report. You can add a filter by using the:
Column Heading Menu
To add a filter to the report from the Search Bar:
Make sure page 2 is still running and click the Select Columns icon in the Search Bar (the icon looks like a magnifying glass).
A list of report columns appears.
Select Assigned To.
The Assigned To column appears in the Search Bar.
carla in the text area and click Go.
The Issues report is displayed showing issues assigned to anyone with "carla" in their first or last name. The search criteria is not case sensitive.
Notice the filter Assigned To contains 'carla' has been added to the Report Settings area above the report. You can edit, disable or delete the filter.
Next, you disable then enable the filter.
Click the Enable/Disable check box next to Assigned To contains 'carla' to disable the filter (the check box is now unchecked).
The report is displayed showing all issues.
Click the Enable/Disable check box next to Assigned To contains 'carla' to once again enable the filter (the check box is now checked).
The report is displayed showing issues assigned to Carla.
Click the Assigned To contains 'carla' link.
The Filter edit options are displayed.
For Operator, select does not contain.
The name of the filter is changed and the report shows issues assigned to everyone with the exception of those assigned to Carla.
Next delete the filter. Click the Filter Delete icon to the right of the Enable/Disable checkbox (it looks like a filter with an X over it).
The filter is removed from the report settings area and the report appears with all issues displayed.
In this exercise, you save the current report settings as the default and customize the report to only show a few columns. You save the customized report settings for future use.
To save the report settings as the default:
Click the Actions menu and select Save Report.
The Save Report options region appears.
For Save, select As Default Report Settings.
The current report format is now the default. When the user resets the report, these settings are applied. For reset instructions, see Resetting to the Default Report Settings.
To customize the report to include only a few columns:
Click the Actions menu and select Select Columns.
The Select Columns options region appears.
In the Display in Report box hold down the control key and select Issue Summary, Status, Priority, Target Resolution Date and Actual Resolution Date.
Click the Remove arrow (<) to add the selected columns to the Do Not Display box.
The report displays with only 5 columns.
To save customized report settings:
Click the Actions menu and select Save Report.
The Save Report options region appears.
For the Save Report options, make these changes:
Save - Select As Named Report
Name - Enter
Description - Enter
Only show 5 columns.
The report appears with report tabs at the top and Saved Report = "Report 1" in the Report Settings area.
Notice there are two tabs, the Working Report and Report 1 tabs. The Report 1 tab highlighted in orange is the current report being displayed. You can customize this report further and save your changes, as shown in the proceeding steps, or you can select the Working Report tab and make changes there. Changes made to the Working Report do not affect any of the saved reports.
You can edit the saved report tab by clicking the Saved Report = "Report 1" link in the report settings area and making changes to the Save Report options.
Note:Because the Named Report is only for the current user who is logged in, the capability to create a Named Report is only available if the application or page is not publilc and has some sort of authentication. See "Editing Interactive Reports" in the Oracle Database Application Express User's Guide for further information.
You can also remove the saved report. Follow these steps to delete the saved report:
Click the Delete Report icon (it looks like a report with an X over it) next to the Saved Report = "Report 1" link in the report settings area.
The customized report with 5 columns appears with the saved report tabs removed.
In this section, you reset the report back to the default settings saved at the beginning of "Saving Report Settings and Selecting Columns" .
To reset the report:
Click the Actions menu and select Reset.
The report appears with the default report settings applied.
Congratulations, you now understand the Application Express reporting basics and are ready to try Chapter 4, "Using Advanced Report Techniques".
For additional information on this and related topics:
Interactive Report Online Help
Oracle Database Application Express Advanced Tutorials
Oracle Database 2 Day + Application Express Developer's Guide
"Building the Application"
Oracle Database Application Express User's Guide
"Editing Interactive Reports"
Using Interactive Report Regions (OBE)
Building and Customizing an Interactive Report (OBE)
Utilizing Advanced Interactive Report Region Techniques (OBE)