Contents

Title and Copyright Information

Preface

Audience

Documentation Accessibility

Related Documents

Conventions

1 About these Tutorials

What this Book Is Not

Tutorial Topics

About Loading Sample Objects

Downloading OEHR Sample Objects

Importing and Installing OEHR Sample Objects

Viewing Database Objects

About Application Authentication

2 How to Create a Tabular Form

Creating an Application

Creating a Tabular Form Using a Wizard

Changing an Updatable Column to a Select List

Create a Named List of Values

Edit the Column to Display as a Select List

3 How to Create a Parameterized Report

Introducing Application Express Reports

Overview of Report Types

Selecting the Appropriate Report Type

Creating an Application with Interactive Reports

Create and Populate the Database Objects

Create the Application

Preview the Application

Add Columns of Data from Other Tables

Using an Interactive Report

Introducing Interactive Report Components

Adding a Filter to a Report

Saving Report Settings and Selecting Columns

Resetting to the Default Report Settings

Related Documentation

4 Using Advanced Report Techniques

Create the Basic Application

Create and Populate the Database Objects

Create the Application

Run the Application

Display People and Project Names

Change the Query to Retrieve Values from Other Tables

Add Name Value Columns to the Display

Add a Dashboard Page

Create a Dashboard Page

Add a Link on the Home Page to the Dashboard

Add an Overdue Issues Report Region to the Dashboard

Add an Open Issues by Project Pie Chart

Related Documentation

5 How to Control Form Layout

Creating a Table and Data Input Form

Create the HT_EMP Table

Create a New Application

Create a New Page Containing an Input Form

Run the Page

Changing the Appearance of a Page by Altering Region Attributes

Edit the Region Title

Change the Display Point and Template

Change the Region Attributes Back to the Original Selections

Understanding How Item Attributes Affect Page Layout

Edit Item Attributes

Fix Item Alignment

Change a Region to Display-only

Adding a Region Header and Footer

Making a Region Conditional

Adding a Region to Contain Hint Text

Changing Item Types

Change an Item to a Radio Group

Change an Item to a Select List

Change an Item to a Check Box

About Label Templates

Changing Buttons

Running the Page for Update

Making Data Bold

6 How to Work with Check Boxes

Creating an Application

Run the Application

Editing the Update Form

Hide the Warranty Period Field

Add a New Checkbox

Change the Report Display

Create Multi Value Check Boxes to Filter Content

Change the Search Field to a Multi Value Check Box

Edit the Report Region Definition

Change the Default Check Box Behavior

Change the Check Boxes to Display in Bold

Adding Check Boxes to Each Row in the Report

Call APEX_ITEM.CHECKBOX

Add a Button to Submit Check Box Array Values

Add a Process

7 How to Implement a Web Service

About Creating Web Service References

Creating a New Application

Specifying an Application Proxy Server Address

Creating a Web Service Reference from a WSDL

Create a Form and Report

Creating a Web Service Reference Manually

Create a Web Service Reference Manually

Test the Web Service

Create a Page to Call the Manual Web Service

Create a Submit Button

Create Items for ZIP Code and Radius

Create a Process to Call the Manually Created Web Reference

Create a Report on the Web Service Result

8 How to Create a Stacked Bar Chart

About the Syntax for Creating Chart Queries

Creating an Application

Creating a New Page

Adding Additional Series

Updating the Sample Data

Viewing the Chart

Editing Chart Attributes

9 How to Upload and Download Files in an Application

Creating an Application

Creating an Upload Form

Create an HTML Region

Create an Upload Item

Create a Button

Creating a Report with Download Links

Create a Report on APEX_APPLICATION_FILES

Add Link to Download Documents

Storing Additional Attributes About the Document

Create a Table to Store Document Attributes

Create an Item to Capture the Document Subject

Create a Process to Insert Information

Show Additional Attributes in the Report Region

Storing the Document in a Custom Table

Downloading Documents from the Custom Table

Create a Procedure to Download Documents

Edit the Uploaded Files Region

Change the Download Link to Use the New Procedure

Create Download Page for Embedded PL/SQL Gateway

Security Issues to Consider

10 How to Incorporate JavaScript into an Application

Understanding How to Incorporate JavaScript Functions

Incorporating JavaScript in the HTML Header Attribute

Including JavaScript in a .js File Referenced by the Page Template

About Referencing Items Using JavaScript

Calling JavaScript from a Button

Changing the Value of Form Elements

Creating a Client Side JavaScript Validation

Create an Application on the OEHR_EMPLOYEES Table

Add a Function to the HTML Header Attribute

Edit an Item to Call the Function

Test the Validation by Running the Page

Enabling and Disabling Form Elements

Add a Function to the HTML Header Attribute

Edit an Item to Call the Function

Change the Item to a Select List

Create a Call to the disFormItems Function

11 How to Build an Access Control Page

How Access Control Administration Works

Creating an Application

Download Spreadsheet Data

Create an Application Based on Spreadsheet Data

Run the Application

Creating an Access Control Administration Page

Create an Access Control Page

View the Page

Add Users to the Access Control List

Creating an Authentication Function

Updating the Current Authentication Scheme

Applying Authorization Schemes to Components

Associate an Authorization Scheme with the Application

Associate Edit Privileges with the ID Column

Associate Edit Privileges with the Create Button

Associate Edit Privileges with Page 2

Restrict Access to Page 8

Testing the Application

Log In with View Privileges

Log In with Edit Privileges

Log In with Administrator Privileges

12 How to Review a Packaged Application

What Is a Packaged Application?

About the Supporting Object Utility

Accessing the Supporting Objects Page

About Supporting Objects Installation

Welcome Message

Prerequisites

License Acceptance

Application Substitution Strings

Build Options

Pre-Installation Validations

Pre-Installation Confirmation Message

Installation Scripts

Success Message

About Supporting Objects Deinstallation

View the Deinstallation Confirmation Message

Review the Deinstallation Script

View the Deinstallation Success Message

About Supporting Objects Export

Review the Supporting Objects Export Setting

Where the Export Default Appears When Exporting

About Creating Upgrade Scripts

Utilizing Upgrade Messages

About Refining Your Installation Scripts

Downloading Public Packaged Applications and Sample Code

13 How to Create a Master Detail PDF Report

About Oracle BI Publisher Licensing Requirements

Viewing a Hosted Version of the Application

Loading the Required Objects

Download the Packaged Application

Import and Install the Packaged Application

Creating a Master Detail Form

View the Report

Creating the Report Query

Creating the RTF Template

Download Oracle BI Publisher Desktop

Load the XML Details

Insert the Fields

Include Line Items

Creating the Report Layout

Create a Report Layout

Associate the Report Layout and Report Query

Linking the PDF Report to the Application

Create a Button

Run the Page

About Creating One PDF Containing All Orders

14 How to Design an Issue Tracking Application

Planning and Project Analysis

Planning and Project Analysis

Designing the Database Objects

About the Projects Table

About the People Table

About the Issues Table

Implementing Database Objects

Additional Database Objects Needed

About Building Database Objects

Create and Run a Script to Build Database Objects

View the Created Database Objects

Loading Demonstration Data

15 How to Build and Deploy an Issue Tracking Application

Issue Tracker Application Overview

Issue Tracker User Interface

Issue Tracker Architecture

Building a Basic User Interface

Create the Basic Application

Add Navigation Image List to Home Page

Add Pages to Maintain Projects

Add Pages to Track Users

Add Pages to Track Issues

Add Pages for Summary Reports

Add a Dashboard Page

Adding Advanced Features

Add Support for Email Notification

Add Application Security

Deploying Your Application

Move the Application Definition

Alternate Authentication Mechanisms to Consider

Create Users

Publish the URL

A DDLs and Scripts

Creating Application Database Objects DDL

Creating Issues Script

Oracle® Application Express

Advanced Tutorials

Release 3.2

E11945-02

February 2012

Oracle Application Express Advanced Tutorials, Release 3.2

E11945-02

Copyright © 2003, 2012, Oracle and/or its affiliates. All rights reserved.

Primary Authors: Drue Swadener, Anne Romano, Terri Jennings

Contributors: Carl Backstrom, Amitabh Chhibber, Sharon Kennedy, Jason Straub, and Rekha Vallam

This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.

The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing.

If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable:

U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S. Government customers are "commercial computer software" or "commercial technical data" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of the Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software License (December 2007). Oracle America, Inc., 500 Oracle Parkway, Redwood City, CA 94065.

This software or hardware is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications that may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software or hardware in dangerous applications.

Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group.

This software or hardware and documentation may provide access to or information on content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services.

Preface

Oracle Database Application Express Advanced Tutorials contains tutorials with step-by-step instructions that explain how to create a variety of application components and entire applications using the Oracle Application Express development environment.

Topics in this section include:

Audience

Documentation Accessibility

Related Documents

Conventions

Audience

Oracle Database Application Express Advanced Tutorials is intended for application developers who wish to learn how to build database-centric Web applications using Oracle Application Express. To use this guide, you need to have a general understanding of relational database concepts, the operating system environment under which you are running the Oracle Application Express, and Application Builder.

What is Application Builder? A component of Oracle Application Express, Application Builder is a powerful tool that enables you to quickly assemble an HTML interface (or application) on top of database objects such as tables and procedures. Prior to completing these tutorials, please review Oracle Database 2 Day + Application Express Developer's Guide.

See Also:

"About these Tutorials"

Documentation Accessibility

For information about Oracle's commitment to accessibility, visit the Oracle Accessibility Program website at http://www.oracle.com/pls/topic/lookup?ctx=acc&id=docacc.

Access to Oracle Support

Oracle customers have access to electronic support through My Oracle Support. For information, visit http://www.oracle.com/pls/topic/lookup?ctx=acc&id=info or visit http://www.oracle.com/pls/topic/lookup?ctx=acc&id=trs if you are hearing impaired.

Accessibility of Code Examples in Documentation

Screen readers may not always correctly read the code examples in this document. The conventions for writing code require that closing braces should appear on an otherwise empty line; however, some screen readers may not always read a line of text that consists solely of a bracket or brace.

Accessibility of Links to External Web Sites in Documentation

This documentation may contain links to Web sites of other companies or organizations that Oracle does not own or control. Oracle neither evaluates nor makes any representations regarding the accessibility of these Web sites.

Related Documents

For more information, see these Oracle resources:

Oracle Database Application Express Installation Guide

Oracle Database Application Express Release Notes

Oracle Database 2 Day + Application Express Developer's Guide

Oracle Database Application Express User's Guide

Oracle Database Concepts

Oracle Database Application Developer's Guide - Fundamentals

Oracle Database Administrator's Guide

Oracle Database SQL Reference

SQL*Plus User's Guide and Reference

For additional documentation available on Oracle's Technology Network, please visit the Oracle Application Express web site located at

http://www.oracle.com/technology/products/database/application_express/

For additional application examples, go to the Learning Library. Search for free online training content, including Oracle by Example (OBE), demos, and tutorials. To access the Oracle Learning Library, go to:

http://www.oracle.com/technetwork/tutorials/index.html

For information about Oracle error messages, see Oracle Database Error Messages. Oracle error message documentation is available only in HTML. If you have access to the Oracle Database Documentation Library, you can browse the error messages by range. Once you find the specific range, use your browser's "find in page" feature to locate the specific message. When connected to the Internet, you can search for a specific error message using the error message search feature of the Oracle online documentation.

Many books in the documentation set use the sample schemas of the seed database, which is installed by default when you install Oracle. Refer to Oracle Database Sample Schemas for information on how these schemas were created and how you can use them yourself.

Printed documentation is available for sale in the Oracle Store at

http://oraclestore.oracle.com/

To download free release notes, installation documentation, white papers, or other collateral, please visit the Oracle Technology Network (OTN). You must register online before using OTN; registration is free and can be done at

http://www.oracle.com/technology/membership/

If you already have a user name and password for OTN, then you can go directly to the documentation section of the OTN Web site at

http://www.oracle.com/technology/documentation/

Conventions

The following text conventions are used in this document:

Convention | Meaning
boldface | Boldface type indicates graphical user interface elements associated with an action, or terms defined in text or the glossary.
italic | Italic type indicates book titles, emphasis, or placeholder variables for which you supply particular values.
monospace | Monospace type indicates commands within a paragraph, URLs, code in examples, text that appears on the screen, or text that you enter.

1 About these Tutorials

Oracle Database Application Express Advanced Tutorials contains a series of tutorials that explain how to use Oracle Application Express to create applications and application components. The goal of this book is to help you understand how to use Oracle Application Express through hands-on experience.

This section contains the following topics:

What this Book Is Not

Tutorial Topics

About Loading Sample Objects

About Application Authentication

What this Book Is Not

Oracle Database Application Express Advanced Tutorials is a collection of tutorials with step-by-step instructions. The objective of these tutorials is to demonstrate how to build a particular type of application or application component using the Oracle Application Express development environment.

Where appropriate, this book describes concepts relevant to understanding or completing a task. However, this book is not intended to be a complete discussion of Oracle Application Express concepts. For this type of information, see Oracle Application Express online Help or Oracle Database Application Express User's Guide.

If you are new to Oracle Application Express, please review the Oracle Database 2 Day + Application Express Developer's Guide. This guide introduces you to application development using Oracle Application Express. It leads your through the process of setting up your development environment and walks you through building an initial application.

Tutorial Topics

This document contains the following tutorials:

Title | Description
How to Create a Tabular Form | Illustrates how to create a tabular form within a new application and how to change one of the updatable columns from a text field to a select list.
How to Create a Parameterized Report | Illustrates how to create an interactive report and explains how a user can customize the report.
Using Advanced Report Techniques | Highlights some of the more advanced reporting techniques, such as linking from one interactive report to another and creating declarative filters within a URL.
How to Control Form Layout | Explains how to create a data input form and then change the form layout by editing the region and item attributes.
How to Work with Check Boxes | Illustrates the different ways in which you can create and process check boxes within an application.
How to Implement a Web Service | Explains how to call a Web service from within an application.
How to Create a Stacked Bar Chart | Explains how to create a stacked bar chart within an application.
How to Upload and Download Files in an Application | Illustrates how to create a form and report with links for file upload and download.
How to Incorporate JavaScript into an Application | Describes some usage scenarios for JavaScript and includes details about how to implement them in your application.
How to Build an Access Control Page | Explains how to build an Access Control Administration to restrict access to an application.
How to Review a Packaged Application | Explores the OEHR Sample Objects packaged application. By reviewing the supporting objects behind this application, you can learn how the Supporting Object Utility works so that you can create your own packaged applications.
How to Create a Master Detail PDF Report | Explains how to create a master detail form, define a report query and RTF template, and then create a button to expose the new report.
How to Design an Issue Tracking Application | This tutorial describes how to plan, design and populate data objects for an example Issue Tracking application.
How to Build and Deploy an Issue Tracking Application | Provides step-by-step instructions on how to create and deploy an application that tracks the assignment, status, and progress of issues related to a project.

About Loading Sample Objects

In Oracle Application Express, users log in to a workspace. Think of each workspace as a shared work area that separates your objects, data, and applications into a virtual private database.

Before you can start these exercises, you need to create the appropriate sample objects within your workspace. These sample objects are copies of the objects that are typically installed in two schemas:

Human Resources (HR)

The HR schema contains information about the employees and the facilities where they work. Each employee has an identification number, email address, job identification code, salary, and manager. Employees are assigned to a department and each department is associated with one location that has a full address. including the street name, postal code, city, state or province, and country code.

Order Entry (OE)

The OE schema tracks product inventories and sales of a company's products, including the product identification number, the product name, the associated associates product category, product descriptions, the weight group (for shipping purposes), the warranty periods, the supplier, the status availability, and a minimum price.

To create the objects locally in your workspace, you need to import the OEHR Sample Objects application.

This section contains the following topics:

Downloading OEHR Sample Objects

Importing and Installing OEHR Sample Objects

Viewing Database Objects

Tip:

In order to successfully import the objects associated with the OEHR Sample Objects application, your Oracle database must include Oracle Spatial. If your database instance does not include Oracle Spatial, you can install it using Database Configuration Assistant. To learn more, see the Oracle Database Installation Guide for your operating environment.

Downloading OEHR Sample Objects

To import the OEHR Sample Objects application, you first need to download it from the Oracle Technology Network (OTN):

In your Web browser go to:

http://www.oracle.com/technology/products/database/application_express/packaged_apps/oehr_sample_objects.zip

Locate the OEHR Sample Objects application.

Download the oehr_sample_objects.zip file to your computer.

Unzip and extract the oehr_sample_objects_installer.sql file:

Microsoft Windows - Double-click the oehr_sample_objects.zip file

UNIX or Linux - Enter the following command:

$ unzip oehr_sample_objects.zip

Importing and Installing OEHR Sample Objects

After you download the OEHR Sample Objects application, you need to import it into Oracle Application Express. During the import process, specify that you also want to install both the application and the supporting objects. Installing the application creates the objects and sample data needed to complete the exercises in Oracle Application Express Advanced Tutorials.

To import and install the OEHR Sample Objects application:

Log in to Oracle Application Express. See "Logging In To Oracle Application Express" in Oracle Database Application Express User's Guide.

On the Workspace home page, click Application Builder.

The Application Builder home page appears.

Click the Import button.

For Specify File, specify the following:

Import file - Click Browse and go to the oehr_sample_objects_installer.sql file.

File Type - Select Application, Page, or Component Export.

Verify that File Character Set is correct.

Click Next.

Now that you have imported the file, you want to install it.

To install an imported file, click Next.

The Install Application Wizard appears.

In the Install Application Wizard, specify the following:

Parsing Schema - Select a schema.

Build Status - Select Run and Build Application.

Install As Application - Select Auto Assign New Application ID.

Click Install.

For Supporting Objects, select Yes and click Next.

Confirm your selections by clicking Install.

Click the Home breadcrumb link at the top of the page.

The Application Builder home page appears.

See Also:

"Viewing Database Objects"

Checking Available Space in Your Workspace

If you experience problems installing the OEHR Sample Objects application, verify the available space in your workspace. You many need to request additional storage space.

If you are a workspace administrator, you can:

Determine if you need additional storage space. See "Viewing the Workspace Overview Report" in Oracle Database Application Express User's Guide.

Request additional storage space. See "Requesting Additional Storage" in Oracle Database Application Express User's Guide.

Deleting the OEHR Sample Objects Application

Deleting the OEHR Sample Objects application and selecting to deinstall the supporting objects completely removes all associated objects and sample data.

To delete the OEHR Sample Objects application:

Log in to Oracle Application Express.

On the Workspace home page, click Application Builder.

The Application Builder home page appears.

Select the OEHR Sample Objects application.

The Application home page appears.

On the Tasks list, click Delete this Application.

The Deinstall page appears.

To remove all associated objects and sample data, select Remove Application Definition and Deinstall Supporting Objects.

Click Deinstall.

Viewing Database Objects

Now, take a look at the objects you just created by going to Object Browser. Object Browser enables you to browse, create, and edit objects in your database.

To view the objects:

On the Workspace home page, click SQL Workshop.

Click Object Browser.

As shown in Figure 1-1, Object Browser appears.

Figure 1-1 Object Browser

Description of Figure 1-1 follows
Description of "Figure 1-1 Object Browser"

Object Browser is divided into two sections:

Object Selection pane displays on the left side of the Object Browser page and lists database objects of a selected type within the current schema.

The list of objects that appears depends upon the available objects in the current schema. Note that any object having a red bar adjacent to it is invalid.

Detail pane displays to the right of the page and displays detailed information about the selected object.

From the Object Selection list, select Tables.

In the Object Selection pane, click OEHR_EMPLOYEES from the list.

The Detail pane shows details about the table.

Click the Data tab in the row at the top of the Details pane.

The data in the OEHR_EMPLOYEES table appears. Note that other tabs show additional details about the object you select.

To search for an object name, enter a case insensitive term in the Search field.

To view all objects, leave the Search field blank.

See also:

"Managing Database Objects with Object Browser" in Oracle Database Application Express User's Guide

About Application Authentication

As you create new pages, you can view them by running the page individually or by running an entire application. When you run a page or application, the Application Express engine dynamically renders it into viewable HTML based on data stored in the database.

By default, all the applications you create in these tutorials use Application Express Authentication. Application Express Authentication is a built-in authentication scheme that uses the same internal user accounts you use to log in to a workspace.

The first time you run a page in an application, you are prompted to enter a user name and password. To continue, simply enter your workspace user name and password and then click Login.

When you create your own applications, you can choose from a number of preconfigured authentication schemes or build your own.

See Also:

"Establishing User Identity Through Authentication" in Oracle Database Application Express User's Guide.

2 How to Create a Tabular Form

A tabular form enables users to update multiple rows in a table at once from a single page. You can use the Tabular Form Wizard to create a tabular form that contains a built-in multiple row update process. This built-in process performs optimistic locking behind the scenes to maintain the data integrity.

This tutorial explains how to create a tabular form within a new application and then how to change one of the updatable columns from a text field to a select list. Before you begin, you need to import and install the OEHR Sample Objects application in order to access the necessary sample database objects. See "About Loading Sample Objects".

This section contains the following topics:

Creating an Application

Creating a Tabular Form Using a Wizard

Changing an Updatable Column to a Select List

For additional examples on this and related topics, please visit the following Oracle by Examples (OBEs):

Oracle Application Express 3.0 - Building a Functional Application

http://www.oracle.com/technology/obe/apex/obe30/apexdev30.htm

Using Some Additional New Features in Oracle Application Express 3.1

http://www.oracle.com/technology/obe/apex/apex31nf/apex31misc.htm

Adding Additional Components to your Existing Application

http://www.oracle.com/technology/obe/hol08/apexintro/apex3.1.1_c/apex3.1.1_c_otn.htm

Creating an Application

First, you need to create an application using the Create Application Wizard.

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.

Click Create.

Select Create Application and click Next.

For Name:

Name - Enter Tabular Form.

Application - Accept the default.

Create Application - Select From scratch.

Schema - Select the schema where you installed the OEHR sample objects.

Click Next.

Next, you need to add a page. 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 create an application containing a blank page. Then, you create a tabular form.

Add a blank page:

Under Select Page Type, select Blank and click Add Page.

The new page appears in the list at the top of the page.

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 Preference Derived From and click Next.

For User Interface, select Theme 2 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.

Review your selections and click Create.

The Application home page appears.

See Also:

"Managing Themes" in Oracle Database Application Express User's Guide

Creating a Tabular Form Using a Wizard

The Tabular Form Wizard creates a form to perform update, insert, and delete operations on multiple rows in a database table. Additionally, the wizard creates a multiple row update process that checks for MD5 checksum values before doing the update to prevent lost updates. In the following exercise you create a tabular form on the OEHR_EMPLOYEES table.

To create a tabular form using the Tabular Form Wizard:

On the Application home page, click Create Page.

For the page type, select Form and click Next.

Select Tabular Form and click Next.

For Table/View Owner:

Table/View Owner - Accept the default.

Allowed Operations - Accept the default, Update, Insert, and Delete.

Click Next.

For Table/View Name, select OEHR_EMPLOYEES and click Next.

For Displayed Columns:

For Select Columns, press Ctrl and select the following columns:

FIRST_NAME, LAST_NAME, HIRE_DATE, SALARY, DEPARTMENT_ID

Note:

This exercise limits the number of columns to optimize the display on-screen. For a real form, you would probably want to include additional columns.

Click Next.

For Primary Key, accept the default, EMPLOYEE_ID (Number) and click Next.

For Source Type, accept the default, Existing trigger, and click Next.

For Updatable Columns, select all columns and click Next.

For Page and Region Attributes:

Page - Accept the default.

Page Name - Enter Tabular Form.

Region Title - Accept the default, Tabular Form.

Region Template and Report Template - Accept the defaults.

Breadcrumb - Accept the default.

Click Next.

For Tab, accept the default, Do not use tabs, and click Next.

For Button Labels, specify the following:

Submit button - Enter Apply Changes.

Cancel, Delete, and Add Row buttons - Accept the default label text.

Click Next.

For Branching, accept the defaults and click Next.

Branching tells the Web browser what page to display when the current page is submitted for processing. In this case, you want the user to remain on the current page.

Confirm your selections and click Finish.

Next, run the page to view your new form.

To run the page:

Click the Run Page icon as shown in Figure 2-1.

Figure 2-1 Run Page Icon

Description of Figure 2-1 follows
Description of "Figure 2-1 Run Page Icon"

If prompted to enter a user name and password, enter your workspace user name and password and click Login. See "About Application Authentication".

The tabular form appears as shown in Figure 2-2.

Figure 2-2 Tabular Form

Description of Figure 2-2 follows
Description of "Figure 2-2 Tabular Form"

As shown in Figure 2-2, note that the tabular form contains four buttons. Cancel, Delete, and Apply Changes display in the upper right corner and Add Row displays in the bottom right corner. Additionally, a check box appears to the left of each row to enable the user to select the current row. Users can also select all rows at once by selecting the check box to the left of the column headings. The same check box is also used in conjunction with the Delete button to identify the rows to be deleted.

Note that the overall form layout (that is, the color scheme, button placement, region header placement, and so on) are controlled by templates in the currently selected theme.

See Also:

"Managing Themes" in Oracle Database Application Express User's Guide

Changing an Updatable Column to a Select List

When the Tabular Form Wizard creates a tabular form, updatable columns are displayed, by default, as text fields. In the next exercise, you change the default display of the Department Id column to a select list. To accomplish this, you create a named list of values (LOV) and then edit the column attributes.

Topics in this section include:

Create a Named List of Values

Edit the Column to Display as a Select List

See Also:

"Creating Lists of Values" in Oracle Database Application Express User's Guide

Create a Named List of Values

To create a named LOV for the Department Id:

Click Edit Page 2 on the Developer toolbar as shown in Figure 2-3.

Figure 2-3 Developer Toolbar

Description of Figure 2-3 follows
Description of "Figure 2-3 Developer Toolbar"

The Page Definition for page 2 appears.

Under List of Values, click the Create icon.

Figure 2-4 Create Icon

Description of Figure 2-4 follows
Description of "Figure 2-4 Create Icon"

The Create List of Values Wizard appears.

For Source, select From Scratch and click Next.

For Name and Type:

Name - Enter DEPTID.

Type - Select Dynamic.

Click Next.

For Query or Static Values, replace the existing text with this:

SELECT DISTINCT department_id a, department_id b FROM oehr_employees

Click Create List of Values.

The Page Definition for page 2 appears. Note that the LOV does not yet appear on the Page Definitions.

Edit the Column to Display as a Select List

To edit the column to display as a select list:

Under Regions, click the Report link.

The Report Attributes page appears as shown in Figure 2-5.

Figure 2-5 Column Attributes on the Report Attributes Page

Description of Figure 2-5 follows
Description of "Figure 2-5 Column Attributes on the Report Attributes Page"

Under Column Attributes, click the Edit icon next to the DEPARTMENT_ID column as shown in Figure 2-5. The Edit icon resembles a small page with a pencil on top of it.

The Column Attributes page appears.

Next, change the default display of this column to a select list.

Scroll down to Tabular Form Element. From Display As, select Select List (named LOV).

Scroll down to Lists of Values. From Named LOV, select DEPTID.

Scroll up to the top of the page and click Apply Changes.

Click the Run Page icon in the upper right corner of the page.

As shown in Figure 2-6, notice the Department Id column now displays as a select list.

Figure 2-6 Tabular Form with Department Id Column Changed to a Select List

Description of Figure 2-6 follows
Description of "Figure 2-6 Tabular Form with Department Id Column Changed to a Select List"

Note:

Do not modify the select list of a SQL statement of a tabular form after it has been generated. Doing so can result in a checksum error when altering the data in the form and applying updates.

Consider the following example:

SELECT first_name FROM oehr_employees;

Note that this should not be altered to:

SELECT lower(first_name) FROM oehr_employees

3 How to Create a Parameterized Report

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:

Introducing Application Express Reports

Creating an Application with Interactive Reports

Add Columns of Data from Other Tables

Using an Interactive Report

Related Documentation

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.

Introducing Application Express Reports

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:

Overview of Report Types

Selecting the Appropriate Report Type

Overview of Report Types

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.

Figure 3-1 Interactive Report

Description of Figure 3-1 follows
Description of "Figure 3-1 Interactive Report"

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.

Figure 3-2 Classic Report

Description of Figure 3-2 follows
Description of "Figure 3-2 Classic Report"

Notice there is no search bar, no column heading links and no drill down capability.

Selecting the Appropriate Report Type

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.

Creating an Application with Interactive Reports

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".

Figure 3-3 Home Page

Description of Figure 3-3 follows
Description of "Figure 3-3 Home Page"

Figure 3-4 Issues Report

Description of Figure 3-4 follows
Description of "Figure 3-4 Issues Report"

Figure 3-5 Issue Details Form

Description of Figure 3-5 follows
Description of "Figure 3-5 Issue Details Form "

This section contains the following topics:

Create and Populate the Database Objects

Create the Application

Preview the Application

Introducing Interactive Report Components

Create and Populate the Database Objects

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".

Create the 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.

Click Create.

Select Create Application and click Next.

For Name, specify the following:

Name - Enter Parameterized Report.

Application - Accept the default.

Create Application - Select From scratch.

Schema - Select the schema where you installed the OEHR sample objects.

Click Next.

Next, add a blank page.

Under Add Page, specify the following:

Select Page Type - Select Blank.

Page Name - Enter Home.

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:

ISSUE_DESCRIPTION

RESOLUTION_SUMMARY

CREATED_ON

CREATED_BY

MODIFIED_ON

MODIFIED_BY

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.

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 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.

Figure 3-6 Application Home Page

Description of Figure 3-6 follows
Description of "Figure 3-6 Application Home Page"

Preview the Application

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.

Figure 3-7 Issues Report

Description of Figure 3-7 follows
Description of "Figure 3-7 Issues Report"

For the first row, click the Edit icon.

The Issue Details form appears as shown in Figure 3-8.

Figure 3-8 Issue Details Form

Description of Figure 3-8 follows
Description of "Figure 3-8 Issue Details Form"

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.

Add Columns of Data from Other Tables

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.

Figure 3-9 Actions Menu Icon

Description of Figure 3-9 follows
Description of "Figure 3-9 Actions Menu Icon"

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.

Figure 3-10 Select Columns Options

Description of Figure 3-10 follows
Description of "Figure 3-10 Select Columns Options"

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:

Issue Summary

Identified By

Identified Date

Project Name

Assigned To

Status

Priority

Target Resolution Date

Progress

Actual Resolution Date

Click Apply.

The Issue report appears with the new columns.

Figure 3-11 Issues Report with Additional Columns

Description of Figure 3-11 follows
Description of "Figure 3-11 Issues Report with Additional Columns"

Using an Interactive Report

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:

Introducing Interactive Report Components

Adding a Filter to a Report

Saving Report Settings and Selecting Columns

Resetting to the Default Report Settings

Introducing Interactive Report Components

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:

Figure 3-12 Interactive Report Components

Description of Figure 3-12 follows
Description of "Figure 3-12 Interactive Report Components"

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.

Adding a Filter to a Report

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:

Search Bar

Column Heading Menu

Actions 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.

Figure 3-13 List of Columns for Search

Description of Figure 3-13 follows
Description of "Figure 3-13 List of Columns for Search"

Select Assigned To.

The Assigned To column appears in the Search Bar.

Figure 3-14 Assigned To in the Search Bar

Description of Figure 3-14 follows
Description of "Figure 3-14 Assigned To in the Search Bar"

Enter 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.

Figure 3-15 Filter for Issues Assigned to Carla

Description of Figure 3-15 follows
Description of "Figure 3-15 Filter for Issues Assigned to Carla"

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.

Figure 3-16 Filter Edit Options

Description of Figure 3-16 follows
Description of "Figure 3-16 Filter Edit Options"

For Operator, select does not contain.

Click Apply.

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.

Saving Report Settings and Selecting Columns

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.

Click Apply.

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.

Click Apply.

The report displays with only 5 columns.

Figure 3-17 Customized Report

Description of Figure 3-17 follows
Description of "Figure 3-17 Customized Report"

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 Report 1

Description - Enter Only show 5 columns.

Click Apply.

The report appears with report tabs at the top and Saved Report = "Report 1" in the Report Settings area.

Figure 3-18 Save Customized Settings as Report 1

Description of Figure 3-18 follows
Description of "Figure 3-18 Save Customized Settings as Report 1"

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.

Click Apply.

The customized report with 5 columns appears with the saved report tabs removed.

Resetting to the Default Report Settings

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.

Click Apply.

The report appears with the default report settings applied.

Figure 3-19 Reset Report

Description of Figure 3-19 follows
Description of "Figure 3-19 Reset Report"

Congratulations, you now understand the Application Express reporting basics and are ready to try Chapter 4, "Using Advanced Report Techniques".

Related Documentation

For additional information on this and related topics:

Interactive Report Online Help

Oracle Database Application Express Advanced Tutorials

"Using Advanced Report Techniques"

"How to Design an Issue Tracking Application"

"How to Build and Deploy an Issue Tracking Application"

Oracle Database 2 Day + Application Express Developer's Guide

"Building the Application"

Oracle Database Application Express User's Guide

"Editing Interactive Reports"

For additional application examples, go to the Learning Library. Search for free online training content, including Oracle by Example (OBE), demos, and tutorials. To access the Oracle Learning Library, go to:

http://www.oracle.com/technetwork/tutorials/index.html

4 Using Advanced Report Techniques

In this tutorial, you create an application that highlights some of the more advanced interactive reporting techniques.

The following procedures are described:

Augmenting the report to include data from other tables.

Adding a navigation link from the home page to an interactive report.

Creating a column link from one interactive report to another.

Passing column values from one interactive report to another.

Querying an interactive report for column values.

This tutorial contains the following topics:

Create the Basic Application

Display People and Project Names

Add a Dashboard Page

Related Documentation

Create the Basic Application

In this section, you create the database objects, load them with sample data and create the basic application. The Create Application Wizard is used to build the application containing a Home page and an Issues report page. The Issues report page enables users to view issues stored in the IT_ISSUES table.

This section includes the following topics:

Create and Populate the Database Objects

Create the Application

Run the Application

Create and Populate the Database Objects

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".

Create the Application

Now, you create an application using the Create Application Wizard.

To create an application with a Home page and an Issues Report page:

On the Workspace home page, click the Application Builder icon.

Click Create.

For Method, select Create Application and click Next.

For Name, make these changes:

Name - Enter Advanced Reports.

Create Application - Select From scratch.

Schema - Select schema containing loaded IT data objects.

Click Next.

Under Add Page, make these changes:

Select Page Type - Select Blank.

Page Name - Enter Home.

Click Add Page.

Under Add Page, make these changes:

Select Page Type - Select Report.

Subordinate to Page - Select Home (1).

Page Source - Select Table.

Table Name - Select IT_ISSUES.

Implementation - Select Interactive.

Click Add Page.

Under Create Application, click the It_Issues link.

The New Page Definition window appears.

Under Page Definition, for Page Name, enter Issues.

Under Report Columns, for Show select No for each of the following columns then click Apply Changes:

ISSUE_DESCRIPTION

TARGET_RESOLUTION_DATE

PROGRESS

ACTUAL_RESOLUTION_DATE

RESOLUTION_SUMMARY

CRETATED_ON

CREATED_BY

MODIFIED_ON

MODIFIED_BY

Click Next.

For Tabs, select No Tabs and click Next.

For Shared Components, accept the default, No, and click Next.

For Attributes, accept all defaults and click Next.

For User Interface, select Theme 20 and click Next.

Review application attributes and click Create.

Run the Application

Now, run the Advanced Reports application and view the Home page, Issues Reports page and Single Row View.

To run the application:

Click the Run Application icon.

When prompted, enter your workspace user name, your password and click Login.

This authentication is part of the default security of any newly created application. See "About Application Authentication".

As shown in Figure 4-1, the home page appears.

Figure 4-1 Initial Home Page

Description of Figure 4-1 follows
Description of "Figure 4-1 Initial Home Page"

Click the Issues link.

The Issue report page displays as shown in Figure 4-2, "Initial Issues Report".

Figure 4-2 Initial Issues Report

Description of Figure 4-2 follows
Description of "Figure 4-2 Initial Issues Report"

Locate the Link Column icon for Issue Id 1 as shown in Figure 4-3, "Single Row View Icon".

Figure 4-3 Single Row View Icon

Description of Figure 4-3 follows
Description of "Figure 4-3 Single Row View Icon"

Click the Link Column icon for Issue Id 1.

The Single Row View for the first issue appears as shown in Figure 4-4, "Single Row View of the First Issue".

Figure 4-4 Single Row View of the First Issue

Description of Figure 4-4 follows
Description of "Figure 4-4 Single Row View of the First Issue"

The Create Application Wizard configured the Issues interactive report Link Column to display the Single Row View. This is the default when the wizard creates a page type of Report.

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 the Application ID link on the Developer toolbar at the bottom of the page to return to the Application home page.

Notice that the Create Application Wizard also created a Login page.

Display People and Project Names

In this section, you replace columns containing person Ids and project Ids with columns containing actual name values. Because the IT_ISSUES table does not contain person names or project names, the query is modified to join with tables that have this information. After modifying the query, you run the page and use the Select Columns action to add the name value columns to the display.

Topics in this section include:

Change the Query to Retrieve Values from Other Tables

Add Name Value Columns to the Display

Change the Query to Retrieve Values from Other Tables

There are four columns in the Issues report that display Ids rather than person and project names. In this section, you replace three of those columns, the Issues Id column remains, with columns containing actual person and project names.

In order to accomplish this, you edit the query to include a join of the IT_PEOPLE and IT_PROJECTS tables. The following Id columns are replaced with name value columns as described here:

Identified By Person Id is replaced with Identified By

Related Project Id is replaced with Project Name

Assigned to Person Id is replaced with Assigned To

To change the SQL query:

Select 2 - Issues page.

Under Regions, select Issues.

Scroll down to Source and replace Region Source with this SQL:

SELECT "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",
    "IT_ISSUES"."ISSUE_ID" as "ISSUE_ID",
    "IT_ISSUES"."RELATED_PROJECT_ID" as "PROJECT_ID"
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.

Add Name Value Columns to the Display

Next, run the Issues interactive report page and use the Select Columns action to include the three additional name value columns to the display.

To add columns to the display:

Click the Run Page 2 icon at the top right corner of the page.

Click the Actions menu to the right of the Go button as shown in Figure 4-5.

Figure 4-5 Action Icon

Description of Figure 4-5 follows
Description of "Figure 4-5 Action Icon"

Select the Select Columns action.

Your page should look similar to Figure 4-6.

Figure 4-6 Select Columns Action Options Page

Description of Figure 4-6 follows
Description of "Figure 4-6 Select Columns Action Options Page"

Highlight Identified By in the Do Not Display box and click the Move icon (>).

Repeat the previous step for Project Name, and Assigned To.

The only column left in the Do Not Display box is Project Id. All other columns appear in the Display in Report list.

Click Apply at the bottom right of the Select Columns area.

Your Issues page should now look like Figure 4-7.

Figure 4-7 Issues Report with Person and Project Names

Description of Figure 4-7 follows
Description of "Figure 4-7 Issues Report with Person and Project Names"

Add a Dashboard Page

The Dashboard provides a quick snapshot of important issue tracking statistics. Regions displayed on the Dashboard include:

Overdue Issues Report

Open Issues by Project Pie Chart

Upon completion of this section, the application will have a Dashboard page similar to the one shown in Figure 4-8, "Dashboard".

Figure 4-8 Dashboard

Description of Figure 4-8 follows
Description of "Figure 4-8 Dashboard"

Topics in this section include:

Create a Dashboard Page

Add an Overdue Issues Report Region to the Dashboard

Add an Open Issues by Project Pie Chart

Create a Dashboard Page

First, you add a blank page to the application and name it Dashboard.

To add the Dashboard page:

Click the Application ID link on the Developer Toolbar.

Click Create Page.

Select Blank Page and click Next.

For Page Number, enter 3 and click Next.

For Create Page, make these changes:

Name - Enter Dashboard.

Title - Enter Dashboard.

Breadcrumb - Select Breadcrumb.

Entry Name - Enter Dashboard.

Parent Entry - Select the Home link.

Click Next.

For Tabs, select No and click Next.

Review selections and click Finish.

Add a Link on the Home Page to the Dashboard

Next, you add a link on the Home page to take users to the Dashboard. This link appears in the Navigation region on the left side of the Home page.

To add a link on the Home page to the Dashboard:

Navigate to the Page Definition for the Home page, page 1:

Click the Application home breadcrumb.

On the Application home page, click 1 - Home.

Under Regions, click the List link (next to Navigation).

On the List Entries page, click the Create List Entry button on the right side of the page.

On the Create/Edit List Entry page, edit the following:

Sequence - Enter 20.

List Entry Label - Enter Dashboard.

Page - Enter 3.

Click Create.

Click the Application breadcrumb.

Click Run Application.

Figure 4-9 Navigation Links

Description of Figure 4-9 follows
Description of "Figure 4-9 Navigation Links"

Notice that your Home page now includes a link to Dashboard.

Click Dashboard to test the link.

The blank Dashboard page appears.

Add an Overdue Issues Report Region to the Dashboard

Next, you add a report region to the Dashboard page that displays overdue issues and then add a link from the report to the Issues interactive report.

Create an Overdue Issues Report Region

The query for this report retrieves all unclosed issues with a past target resolution date.

To add a report region:

Click Edit Page 3 on the Developer Toolbar.

Under Regions, click the Create icon.

Select Report and click Next.

For Report Implementation, select SQL Report and click Next.

For Display Attributes:

Title - Enter Overdue Issues.

Region Template - Select Reports Region, Alternative 1.

Sequence - Enter 5.

Click Next.

For Source, enter the following in Enter SQL Query:

SELECT i.issue_id, i.priority, i.issue_summary,
    p.person_name assignee, i.target_resolution_date, r.project_name
FROM it_issues i, it_people p, it_projects r
WHERE i.assigned_to_person_id = p.person_id (+)
    AND i.related_project_id = r.project_id
    AND i.target_resolution_date < sysdate
    AND i.status != 'Closed'

The outer join is necessary because the assignment is optional.

Click Create Region.

Add a Link Column and Create a Declarative Filter on an Interactive Report

The following steps show you how to create a link column from the Overdue Issues Report to the Issues interactive report and how to define a declarative filter by passing filter criteria using the URL item values.

To add a link from the Project Name column to the Issues interactive report:

Under Regions, click the Report link.

Click the Edit icon to the left of PROJECT_NAME.

Scroll down to Column Link:

For Link Text, Select [PROJECT_NAME]

For Link Attributes, enter:

title="Click to see all issues for this project."

This setting defines the item help text for the link column.

For Page, select 2.

For Clear Cache, enter:

CIR,2

This link column includes a Clear Interactive Report command, CIR, to clear the Issues interactive report of any filters, control breaks, highlights, aggregates, computed columns, chart settings and flashback settings.The 2 clears the cache for the Issues report (page 2).

Note:

If you want to reset the interactive report, replace CIR with RIR (Reset Interactive Report). The RIR command resets the report to the last saved default report settings.

For Item 1, enter the Name:

IR_PROJECT_NAME

For Item 1, enter the Value:

#PROJECT_NAME#

The Name and Value settings create a declarative filter for the Issues interactive report. The Project Name link passes the value of the Project Name column to the Issues report. When the link is clicked by the user, the Issues report displays all issues for that project, regardless of whether or not the issue is overdue.

Click Apply Changes.

Run the Application

To run the application:

Navigate to the Application home page and click the Run Application icon.

The Application home page displays.

Click the Dashboard link.

You should see the Dashboard page with the Overdue Issues region added as shown in Figure 4-10, "Dashboard with Overdue Issues Region Added". Notice the Project Names are displayed as links.

Figure 4-10 Dashboard with Overdue Issues Region Added

Description of Figure 4-10 follows
Description of "Figure 4-10 Dashboard with Overdue Issues Region Added"

Click the New Payroll Rollout project name.

The Issues interactive report displays showing all issues categorized under the New Payroll Rollout project name.

Figure 4-11 Issues for New Payroll Rollout

Description of Figure 4-11 follows
Description of "Figure 4-11 Issues for New Payroll Rollout"

Notice the 'New Payroll Rollout' filter at the top of the report. The filter was created when the user clicked the Project Name link column.

Add an Open Issues by Project Pie Chart

Next, add a pie chart that displays Open Issues by Project and links to the Issues report. The pie chart query gets the number of open issues for each project name from the Issues interactive report. The project names, displayed on the pie chart, link to the Issues report where all issues for the selected project appear.

Create a Pie Chart Region that Links to the Issues Report

To create a region containing a pie chart:

Click the Application ID link on the Developer Toolbar.

Click 3 - Dashboard.

Under Regions, click the Create icon.

Select Chart and click Next.

Select Flash Chart and click Next.

For Display Attributes, make these changes:

Title - Enter Open Issues by Project.

Region Template - Select Chart Region.

Sequence - Enter 10.

Column - Select 2.

Click Next.

For Chart Preview, make these edits:

Chart Type - Select 3D Pie.

Click Next.

For Source, enter the following in SQL:

SELECT
    'f?p=&APP_ID.:2:&SESSION.:::CIR:IREQ_STATUS,IREQ_PROJECT_ID:Open,'||r.project_id LINK,
    NVL(r.project_name,'No Project') label,
    COUNT(r.project_name) value
FROM it_issues i, it_projects r
WHERE i.status = 'Open' AND i.related_project_id = r.project_id
    GROUP BY NULL, r.project_name, r.project_id
    ORDER BY r.project_name, r.project_id

Notice the SELECT statement is sending a request to the Issues interactive report page 2 asking for the number of issues that belong to a particular project name and that have a status of Open. The CIR command is used to Clear the Interactive Report to make sure all of the requested values are included in the query and have not been filtered out or set as a column to not display.

For When No Data Found Message, enter No open issues.

Click Create Region.

Run the Dashboard and Link to the Issues Report

Next, you run the Dashboard page to view the added pie chart region and select one of the project names to link to the Issues report.

To view the revised Dashboard page:

Click the Run Page 3 icon.

The Dashboard displays with the added pie chart region.

Figure 4-12 Final Dashboard with Both regions Added

Description of Figure 4-12 follows
Description of "Figure 4-12 Final Dashboard with Both regions Added"

On the pie chart, locate the Employee Satisfaction Survey project link as shown in Figure 4-13.

Figure 4-13 Dashboard Open Issues by Project Pie Chart

Description of Figure 4-13 follows
Description of "Figure 4-13 Dashboard Open Issues by Project Pie Chart"

Click the Employee Satisfaction Survey project link.

The Issues report for all Employee Satisfaction Survey issues with a status of Open appears as shown in Figure 4-14.

Figure 4-14 Issues Report for Open Employee Satisfaction Survey Issues

Description of Figure 4-14 follows
Description of "Figure 4-14 Issues Report for Open Employee Satisfaction Survey Issues"

Notice the filters in the report settings section. The Issues report has been filtered by project and by status.

Related Documentation

For additional information on this and related topics:

Interactive Report Online Help

Oracle Database Application Express Advanced Tutorials

"Using Advanced Report Techniques"

"How to Design an Issue Tracking Application"

"How to Build and Deploy an Issue Tracking Application"

Oracle Database 2 Day + Application Express Developer's Guide

"Building the Application"

Oracle Database Application Express User's Guide

"Editing Interactive Reports"

For additional application examples, go to the Learning Library. Search for free online training content, including Oracle by Example (OBE), demos, and tutorials. To access the Oracle Learning Library, go to:

http://www.oracle.com/technetwork/tutorials/index.html

5 How to Control Form Layout

Data and form elements in an Oracle Application Express application are placed on a page using containers called regions. There are several attributes that control the placement and positioning of regions on pages. In turn, you control the placement and style of form elements (called items) inside of regions using item attributes.

In this tutorial, you create the underlying data objects for a data input form by running a script. Then, you create a data input form and learn how to change the form layout by altering region and item attributes.

This section contains the following topics:

Creating a Table and Data Input Form

Changing the Appearance of a Page by Altering Region Attributes

Understanding How Item Attributes Affect Page Layout

Adding a Region Header and Footer

Making a Region Conditional

Adding a Region to Contain Hint Text

Changing Item Types

About Label Templates

Changing Buttons

Running the Page for Update

Making Data Bold

For additional examples on this and related topics, please visit the following Oracle by Examples (OBEs):

Creating and Running an Application

http://www.oracle.com/technology/obe/hol08/apexintro/apex3.1.1_b/apex3.1.1_b_otn.htm

Using Some Additional New Features in Oracle Application Express 3.1

http://www.oracle.com/technology/obe/apex/apex31nf/apex31misc.htm

Adding Additional Components to your Existing Application

http://www.oracle.com/technology/obe/hol08/apexintro/apex3.1.1_c/apex3.1.1_c_otn.htm

Creating a Table and Data Input Form

The first step in creating a data input form is to create the underlying data objects. In this exercise, you create a table named HT_EMP and then use a wizard to create a new page.

Topics in this section include:

Create the HT_EMP Table

Create a New Application

Create a New Page Containing an Input Form

Run the Page

Create the HT_EMP Table

First, you create a new table by running a script in SQL Scripts.

To create the HT_EMP table and the appropriate associated objects:

On the Workspace home page, click SQL Workshop and then SQL Scripts.

The SQL Scripts home page appears.

Click Create.

The Script Editor appears.

In Script Name, enter HT_EMP.

In the Script Editor, enter the following data definition language (DDL):

CREATE TABLE ht_emp (
   emp_id                 NUMBER       primary key,
   emp_first_name         VARCHAR2(30) not null,
   emp_middle_initial     VARCHAR2(1),
   emp_last_name          VARCHAR2(45) not null,
   emp_part_or_full_time  VARCHAR2(1)  not null check (emp_part_or_full_time in ('P','F')),
   emp_salary             NUMBER,
   emp_dept               VARCHAR2(20) check (emp_dept in ('SALES','ACCOUNTING',

'MANUFACTURING','HR')),
   emp_hiredate           DATE,
   emp_manager            NUMBER       references ht_emp,
   emp_special_info       VARCHAR2(2000),
   emp_telecommute        VARCHAR2(1) check (emp_telecommute in ('Y')),
   rec_create_date        DATE         not null,
   rec_update_date        date)
/

INSERT INTO ht_emp
   (emp_id, emp_first_name, emp_middle_initial, emp_last_name, emp_part_or_full_time, emp_salary, emp_dept, emp_hiredate, emp_manager, emp_special_info, emp_telecommute, rec_create_date)
VALUES
   (1,'Scott','R','Tiger','F',
    100000,'SALES',sysdate,null,'cell phone number is xxx.xxx.xxxx
home phone is yyy.yyy.yyyy','Y',
    SYSDATE)
/

CREATE SEQUENCE ht_emp_seq
   start with 2
/

CREATE OR REPLACE TRIGGER bi_ht_emp
      BEFORE INSERT ON ht_emp
      FOR EACH ROW
   BEGIN
      SELECT ht_emp_seq.nextval
        INTO :new.emp_id
        FROM DUAL;
      :new.rec_create_date := SYSDATE;
   END;
/

CREATE OR REPLACE TRIGGER bu_ht_emp
      BEFORE UPDATE ON ht_emp
      FOR EACH ROW
   BEGIN
      :new.rec_update_date := SYSDATE;
   END;
/

Click Save.

The script appears in the SQL Scripts Repository.

Run the HT_EMP script:

Click the HT_EMP script.

Click Run.

On the Run Script page, click Run again.

From the View list, select Details and click Go.

Figure 5-1 Details View in the Manage Script Results Page

Description of Figure 5-1 follows
Description of "Figure 5-1 Details View in the Manage Script Results Page"

Click the View Results icon to access the Results page.

Red text indicates errors while executing the file.

See Also:

"Using SQL Scripts" in Oracle Database Application Express User's Guide.

Create a New Application

Next, create a new application.

To create an application:

Return to the Workspace home page. Click the Home breadcrumb link at the top of the page.

On the Workspace home page, click the Application Builder icon.

The Application Builder home page appears.

Click Create.

Select Create Application and click Next.

For Name, specify the following:

Name - Enter Form Layout.

Application - Accept the default.

Create Application - Accept the default, From scratch.

Schema - Select the schema where you installed the OEHR sample objects.

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 add two blank pages.

Add a blank page:

Under Select Page Type, accept the default, Blank.

Click Add Page.

The blank page appears at the top of the page.

Click Next.

For Tabs, accept the default, One Level of Tabs, and then 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 Preference Derived From and then click Next.

For User Interface, select Theme 12 and then click Next.

Review your selections and click Create.

The Application home page appears. Note that your application contains two pages.

Create a New Page Containing an Input Form

Next, create a new form using the Form on a Table or View Wizard.

To create a data input form:

On the Application home page, click Create Page.

For Page, select Form and click Next.

On Create Page, select Form on a Table or View and click Next.

For Table/View Owner, accept the default and click Next.

For Table/View Name, select the HT_EMP table and click Next.

For Page and Region Attributes:

Page Number - Enter 2.

Page Name - Enter Form Layout.

Region Title - Enter Form Layout.

Region Template - Accept the default.

Breadcrumb - Accept the default.

Click Next.

For Tab, accept the default, Do not use tabs, and click Next.

For Primary Key, accept the default and click Next.

Note that the wizard reads the primary key from the database definition.

For Source Type, accept the default Existing Trigger and click Next.

For Select Columns, select all the columns. Press SHIFT, select the first column and then the last one. Then, click Next.

For Process Options, accept the defaults and click Next.

For Branching, enter 2 (the page you are creating) in both fields and click Next.

Since this page is just for demonstration, you will not be utilizing branching.

Click Finish.

Click the Edit Page icon.

The Page Definition for page 2 appears.

Delete the following validation:

Under Page Processing, Validations, select P2_REC_CREATE_DATE not null.

Click Delete.

You are removing this validation because the value of this column is set using a trigger. The item will have no value in the form for a new record. This validation was automatically created because the underlying database column is not null.

Run the Page

Once you create a new input form, the next step is to run the page.

To run the page from the Page Definition:

Click the Run Page icon in the upper right corner as shown in Figure 5-2.

Figure 5-2 Run Page Icon

Description of Figure 5-2 follows
Description of "Figure 5-2 Run Page Icon"

If prompted for a user name and password, enter your workspace user name and password and click Login. See "About Application Authentication".

The application appears.

As shown in Figure 5-3, the new form appears. Note that the form contains basic employee details and includes select lists, text areas, and display only items.

Figure 5-3 Employee Info Form

Description of Figure 5-3 follows
Description of "Figure 5-3 Employee Info Form"

By default, the Primary Key column does not display since it is assumed that the primary key is system generated. In reality, the primary key is included in the page, but appears as a hidden item.

Notice that the page defaults with one item for each row and labels display to the left of the items. The item labels default to the column names with initial capitalization and with the underscores (_) replaced with spaces. You can override this default behavior by configuring user interface defaults for the table.

See Also:

"Managing User Interface Defaults" in the Oracle Database Application Express User's Guide.

Also notice that items based on date columns default to include a date picker. Lastly, notice that the Emp Special Info item was created as a text area because of the size of the base column. This item type is a better choice for large text items since it allows the input text to wrap.

Changing the Appearance of a Page by Altering Region Attributes

A region is an area on a page that serves as a container for content. You can alter the appearance of a page by changing the region attributes.

Topics in this section include:

Edit the Region Title

Change the Display Point and Template

Change the Region Attributes Back to the Original Selections

Edit the Region Title

To edit the region title and other region level attributes:

Click Edit Page 2 on the Developer toolbar.

Under Regions, click Form Layout.

The Region Definition appears.

Change the Title to Employee Info.

Click Apply Changes at the top of the page.

From the Page Definition, click the Run Page icon in the upper right corner.

Note the new region title.

Change the Display Point and Template

To change other region attributes:

Return to the Page Definition. Click Edit Page 2 on the Developer toolbar.

Under Regions, click Employee Info.

The Region Definition appears.

Scroll down to User Interface.

You can control the position of a region within a page template by changing the page template.

From Display Point, select Page Template Region Position 3.

In this instance, your selection moves the region to the right side of the page. The region display points are determined by the page level template. If you do not select a page level template, Oracle Application Express uses the default page level template defined in the current theme. You can view specific positions by selecting the flashlight icon to the right of the Display Point list.

Next, temporarily change the region template.

From Template, select Borderless Region.

Click Apply Changes at the top of the page.

From the Page Definition, click the Run Page icon in the upper right corner.

The form appears as shown in Figure 5-4.

Figure 5-4 Employee Info Form with New Display Point and Template

Description of Figure 5-4 follows
Description of "Figure 5-4 Employee Info Form with New Display Point and Template"

Note the changes in the appearance of the form. The form title displays in a dark color on a white background and has a rule beneath it. Also, note that there is no longer a border around the form.

Change the Region Attributes Back to the Original Selections

To return to the region template and display point to the original selections:

Click Edit Page 2 on the Developer toolbar.

Under Regions, select Employee Info.

Scroll down to User Interface.

From the Template list, select Form Region.

From the Display Point List, select Page Template Body (3. Items above region content).

Click Apply Changes at the top of the page.

Understanding How Item Attributes Affect Page Layout

An item is part of an HTML form. An item can be a text field, text area, password, select list, check box, and so on. Item attributes control the display of items on a page. Item attributes determine where a label displays, how large an item will be as well as whether the item displays next to or below a previous item. You can change multiple item labels at once on the Page Items summary page.

Topics in this section include:

Edit Item Attributes

Fix Item Alignment

Change a Region to Display-only

See Also:

"Creating Items" in Oracle Database Application Express User's Guide.

Edit Item Attributes

To edit all item attributes:

On the Page Definition for page 2, locate the Items section.

Under Items, click the Edit All icon.

The Edit All icon resembles a small grid with a pencil on top of it as shown in Figure 5-5.

Figure 5-5 Edit All Icon

Description of Figure 5-5 follows
Description of "Figure 5-5 Edit All Icon"

The Page Items summary page appears.

You change how a page appears by editing the item attributes. Common item attribute changes include:

Changing item labels by editing the Prompt field.

Placing more than one item in certain rows to group like items together. For example, you could group all items that make up an employee's name.

Changing the item width. Many items display better when they have a width that is less than the maximum. To change the item width, enter a new value in the Width field.

Reordering the items. The initial order of items is based on the order of the columns in the table on which the region is based. To reorder items, enter a new value in the Sequence field.

To see the how item attributes affect page layout, make the following changes:

Change the values in the Prompt, New Line, and Width fields to match those in Table 5-1:

Table 5-1 New Prompt, New Line, and Width Field Values

Prompt Field | New Line | Width
Emp ID | Yes | 30
First Name | Yes | 15
Middle Initial | No | 2
Last Name | No | 15
Part or Full Time | Yes | 2
Salary | Yes | 10
Department | Yes | 15
Hire Date | Yes | 10
Manager | No | 15
Special Information | Yes | 60
Telecommute | Yes | 2
Record Create Date | Yes | 10
Record Update Date | Yes | 10

Click Apply Changes.

Click the Run Page icon in the upper right corner of the page.

Figure 5-6 Employee Info Form After Editing the Prompt, New Line, Width Attributes

Description of Figure 5-6 follows
Description of "Figure 5-6 Employee Info Form After Editing the Prompt, New Line, Width Attributes"

As shown in Figure 5-6, note that some items are pushed too far to the right because of the width of the Special Information item. Oracle Application Express lays out regions as tables, and the width of each column is determined by the largest display width of the items in that column.

Fix Item Alignment

There are several approaches to fixing item alignment:

For the items Middle Initial, Last Name and Manager items, set New Field to equal No.

This places the items directly after the items they follow, but in the same column. This approach is best used for positioning embedded buttons next to items. Note that this setting can make text items appear squashed.

Change the Column Span field of the Special Information item.

For example, setting the Column Span for the Special Information item to 5 would enable multiple items to display above and below it. This change causes five items to display above Special Information (First Name, Middle Initial, and Last Name).

Be aware, however, that using Column Span to fix the display of the name does not result in a consistent layout. The Manager item would still be in the same column as Middle Initial. Because the Manager item is larger than Middle Initial, Last Name would still be pushed too far to the right. To fix this, you could change the Column Span of the Manager item to 3 so it displays above Special Information.

Reset the column width in the middle of the region by adding an item of type Stop and Start HTML Table. This forces the close of an HTML table using the </table> tag and starts a new HTML table. Inserting a Stop and Start HTML Table item just after the Last Name item results in an even layout. Note that a Stop and Start HTML Table item only displays its label. You can prevent the label from displaying at all by setting it to null. To do this, you simply remove the defaulted label.

Add a Stop and Start HTML Table Item

You can use the Drag and Drop Layout page to interactively reorder items within a given region, change select item attributes, create new items, or delete existing items. For this exercise, you will reorder two items.

To add a Stop and Start HTML Table item:

Click Edit Page 2 on the Developer toolbar.

Under Items, click the Drag and drop icon as shown in Figure 5-7.

Figure 5-7 Drag and Drop Icon

Description of Figure 5-7 follows
Description of "Figure 5-7 Drag and Drop Icon "

The Drag and Drop Layout page appears. This page is divided into the Item palette on the left and the Layout region on the right.

Figure 5-8 Drag and Drop Layout Page

Description of Figure 5-8 follows
Description of "Figure 5-8 Drag and Drop Layout Page"

In the Item palette, select the Stop and start table icon and drop it after the row containing the P2_EMP_ID item:

Move your mouse over the icons in the Item palette and locate the Stop and start table. Note that when you position the cursor over an item type, a tooltip appears.

Figure 5-9 Stop and Start Table Item Type

Description of Figure 5-9 follows
Description of "Figure 5-9 Stop and Start Table Item Type"

Click the Stop and start table icon and drag it beneath of P2_EMP_ID.

Click Next.

A report appears. Note that the new Stop and Start HTML Table appears beneath P2_EMP_ID.

Figure 5-10 Revised Drag and Drop Layout Page

Description of Figure 5-10 follows
Description of "Figure 5-10 Revised Drag and Drop Layout Page"

Click Apply Changes.

Edit the Special Information Item

Items are laid out in HTML tables. Next, you need to edit the Column Span attribute for the Special Information item. The Column Span attribute defines the value to be used for the COLSPAN attribute in the table cell.

To edit the Special Information item:

Under Items, click the Reorder Region Items icon.

The Reorder Region Items icon resembles a light green down and up arrow as shown in Figure 5-11.

Figure 5-11 Reorder Region Items Icon

Description of Figure 5-11 follows
Description of "Figure 5-11 Reorder Region Items Icon"

The Reorder Region Items page appears in a separate window.

Items on a page are laid out in tables. You can edit the position of an item by selecting values for the New Line, New Field, Column Span, and Label Alignment attributes. You can change the order in which items display by clicking the up and down arrows in the far right column. Also notice that a graphical representation of how the items display appears at the bottom of the page.

For Special Information, change the Column Span to 3 and click Apply Changes.

Click the Run Page icon in the upper right corner. The form appears as shown in Figure 5-12.

Figure 5-12 Employee Info Form with Corrected Item Alignment

Description of Figure 5-12 follows
Description of "Figure 5-12 Employee Info Form with Corrected Item Alignment"

Change a Region to Display-only

There are two columns in the HT_EMP table for auditing, Record Create Date and Record Update Date. Because the values of these columns are set with triggers, these columns should not be updatable by users. This exercise demonstrates how to make items display-only and then how to add them to their own region.

Topics in this section include:

Change Items to Display-only

Create a New Region

Move Audit Items to the New Region

Change the Region Template to Hide/Show Region

Change Items to Display-only

To make the item P2_REC_CREATE_DATE display-only:

Go to the Page Definition for page 2. Click Edit Page 2 on the Developer toolbar.

Under Items, select the item P2_REC_CREATE_DATE.

From the Display As list in the Name section, select Text Field (Disabled, saves state).

Click Apply Changes.

To make the item P2_REC_UPDATE_DATE display-only:

Go to the Page Definition for page 2.

Under Items, select the item P2_REC_UPDATE_DATE.

From the Display As list in the Name section, select Text Field (Disabled, saves state).

Click Apply Changes.

Next, create a new region and move the display-only items to the new region.

Create a New Region

To create a new region:

Go to the Page Definition for page 2.

Under Regions, click the Create icon.

For Region:

Identify the type of region to add to this page - Accept the default, HTML, and click Next.

Select the type of HTML region container you wish to create - Accept the default, HTML, and click Next.

For Display Attributes, enter Audit Information in the Title field, accept the remaining defaults, and click Next.

Click Create Region.

Move Audit Items to the New Region

To move the items to the new region:

Go to the Page Definition for page 2.

Under Items, click the Edit All icon. The Edit All icon resembles a small grid with a pencil on top of it.

The Page Items summary page appears.

For P2_REC_CREATE_DATE and P2_REC_UPDATE_DATE:

In the Prompt column, add a colon to the end of the label name.

In the Region column, select Audit Information.

Click Apply Changes.

Click the Run Page icon in the upper right corner.

Figure 5-13 demonstrates how these items would display in a running page.

Figure 5-13 Audit Information Region

Description of Figure 5-13 follows
Description of "Figure 5-13 Audit Information Region"

Change the Region Template to Hide/Show Region

The Hide/Show Region template enables the user to click a plus (+) sign to expand the contents of the region or click a minus (-) sign to hide the contents. By changing the region template to Hide/Show Region, users can decide whether they want to see the Audit Information region.

To change the region template to Hide/Show Region:

Go to the Page Definition for page 2.

Under Regions, click Audit Information.

Under User Interface, select Hide and Show Region from the Template list.

Click Apply Changes.

Click the Run Page icon in the upper right corner.

Figure 5-14 demonstrates how Audit Information displays as a Hide/Show region. You can hide the region by clicking the icon to the right of the region title.

Figure 5-14 Audit Information as a Hide/Show Region

Description of Figure 5-14 follows
Description of "Figure 5-14 Audit Information as a Hide/Show Region"

Adding a Region Header and Footer

Regions can have headers and footers. Headers and footers typically contain text or HTML that displays at either the top or bottom of the region.

To add a region footer:

Go to the Page Definition for page 2. Click Edit Page 2 on the Developer toolbar.

Under Regions, select Audit Information.

Scroll down to Header and Footer.

Enter the following in Region Footer:

<i>The Record Create Date is the date that the record was initially entered in
to the system. <br/>The Record Update Date is the date that the
record was last updated.</i>

Click Apply Changes.

Click the Run Page icon in the upper right corner.

Click the arrow next to Audit Information to display the two date fields and new footer text as shown in Figure 5-15.

Figure 5-15 Audit Information Region with Footer

Description of Figure 5-15 follows
Description of "Figure 5-15 Audit Information Region with Footer"

As shown in Figure 5-15, the text of the footer is wrapped with the italic HTML tag and there is an imbedded break. Without the manual break, the text would take up the entire width of the region (as defined by region template).

Making a Region Conditional

To make a region conditional, you create a display condition for the Audit Information region so that it only displays if the Employee ID is not null. Since the Employee ID is set by a trigger, it only exists for records retrieved from the database. You can control the display of the Audit Information region by using a built-in condition that checks for the presence of a value for the item containing the Employee ID (that is, P2_EMP_ID)

To display the Audit Information region conditionally:

Go to the Page Definition for page 2.

Under Regions, select Audit Information.

The Region Definition appears.

Scroll down to Conditional Display.

Under Conditional Display:

From Condition Type, select Value of Item in Expression 1 is NOT NULL.

In Expression 1, enter:

P2_EMP_ID

Click Apply Changes.

Adding a Region to Contain Hint Text

You have the option of displaying regions in columns as well as in rows. This exercise explains how to create another region to display explanatory text (hints) for the user.

To create a region to display hint text:

Go to the Page Definition for page 2.

Under Regions, click the Create icon.

For Region:

Identify the type of region to add to this page - Accept the default, HTML, and click Next.

Select the type of HTML region container you wish to create - Accept the default, HTML, and click Next.

For Display Attributes:

Title - Enter Hint.

Region Template - Select Sidebar Region.

Display Point - Select Page Template Region Position 3.

Sequence - Accept the default.

Column - Select 3.

Click Next.

In Enter HTML Text Region Source, enter the following:

Use this page to enter and<br/>
maintain employee information.

Click Create Region.

Click the Run Page icon. Figure 5-16 shows the new Hint region on the page.

Figure 5-16 Hint Region

Description of Figure 5-16 follows
Description of "Figure 5-16 Hint Region"

Changing Item Types

This exercise describes how to change item types to make data entry easier for the user. To change an item type, go to the Item attributes page and select another Display As option.

Topics in this section include:

Change an Item to a Radio Group

Change an Item to a Select List

Change an Item to a Check Box

Tip:

For simplicity, this tutorial has you alter items by editing item attributes. As a best practice, however, you can also create named LOVs and reference them.

See Also:

"Creating Lists of Values" in Oracle Database Application Express User's Guide

Change an Item to a Radio Group

Because the Part or Full-time item only has two valid choices, this item is a good candidate for either a check box or a radio group.

To change the Part or Full-time item to a radio group:

Go to the Page Definition for page 2. Click Edit Page 2 on the Developer toolbar.

Under Items, select P2_EMP_PART_OR_FULL_TIME.

The Edit Page Item page appears.

Locate the Name section. From the Display As list, select Radiogroup.

Locate the Label section. Specify the following:

Label - Remove the text in the Label field.

Template - Select No Label.

Under List of Values, create a static list of values. Specify the following:

Named LOV - Select Select Named LOV.

List of values definition - Enter:

STATIC:Full-time;F,Part-time;P

This definition will display as two radio buttons with the labels Full-time and Part-time, but the value being inserted into the database will be either F or P.

At the top of the page, click Apply Changes.

Click the Run Page icon in the upper right corner. The modified form appears as shown in Figure 5-17.

Figure 5-17 Part or Full-time item Changed to a Radio Group

Description of Figure 5-17 follows
Description of "Figure 5-17 Part or Full-time item Changed to a Radio Group"

Notice that Full-time and Part-time displays as a radio group that is stacked in one column. You can have these buttons display side by side.

To display the Full-time and Part-time radio buttons side by side:

Go to the Page Definition for page 2.

Under Items, select P2_EMP_PART_OR_FULL_TIME.

Scroll down to List of Values.

In Number of Columns, enter 2.

At the top of the page, click Apply Changes.

Click the Run Page icon.

By changing this setting to match the number of valid values (that is, Full-time and Part-time), the values display side by side as shown in Figure 5-18.

Figure 5-18 Part or Full-time Item Displayed Side by Side

Description of Figure 5-18 follows
Description of "Figure 5-18 Part or Full-time Item Displayed Side by Side"

Change an Item to a Select List

In the DDL you used to create the HT_EMP table, the Department is validated by a check constraint. You can implement the Department as a radio group, a select list, or a Popup LOV.

To change Department to a select list:

Go to the Page Definition for page 2. Click Edit Page 2 on the Developer toolbar

Under Items, select P2_EMP_DEPT.

From the Display As list in the Name section, select Select List.

The other Select List choices are for either redirecting the user to another page or URL based on the selection, or submitting the current page which is used when other information needs to be retrieved based upon the selection in the Select List.

Scroll down to List of Values.

Under List of Values, create a static list of values. Specify the following:

Named LOV - Select Select Named LOV

List of values definition - Enter:

STATIC:SALES,ACCOUNTING,MANUFACTURING,HR

From Display Null, select Yes.

In Null display value, enter:

- No Assignment -

The last two selections take into account that the EMP_DEPT column can contain nulls. As a best practice, whenever you implement a select list and have a column that can be null, you should set Display Null to Yes. Failure to do so results in the item defaulting to the first item in the select list.

At the top of the page, click Apply Changes.

Click the Run Page icon.

The revised form appears as shown in Figure 5-19.

Figure 5-19 Department Changed to a Select List

Description of Figure 5-19 follows
Description of "Figure 5-19 Department Changed to a Select List"

Change an Item to a Check Box

The item Telecommute is ideal for a check box. When you change the Display Type, you can also move it up on the page and place it next to the Full-time and Part-time radio group.

To change Telcommute to a check box:

Go to the Page Definition for page 2. Click Edit Page 2 on the Developer toolbar.

Under Items, select P2_EMP_TELECOMMUTE.

From the Display As list in the Name section, select Checkbox.

Under Displayed, specify the following:

Sequence - Enter 136.

Begin on New Line - Select Yes.

Scroll down to List of Values.

To have the label precede the check box, specify the following:

Named LOV - Select Select Named LOV.

List of values definition - Enter:

STATIC:;Y

This List of values definition displays the check box after the label, but will not display a value associated with the check box. If the check box is checked, the value passed to the database will be Y.

At the top of the page, click Apply Changes.

Click the Run Page icon.

Note that the check box appears for Telecommute as shown in Figure 5-20.

Figure 5-20 Telecommute Field Changed to Check Box

Description of Figure 5-20 follows
Description of "Figure 5-20 Telecommute Field Changed to Check Box"

About Label Templates

You can control the look of an item label by using a label template. You can view the templates associated with the current theme on the Page Definition.

To view templates associated with the current theme:

Go to the Page Definition for page 2. Click Edit Page 2 on the Developer toolbar.

Locate the Shared Components area and note the Theme section as shown in Figure 5-21.

Figure 5-21 Templates and Theme

Description of Figure 5-21 follows
Description of "Figure 5-21 Templates and Theme"

The current theme is Blue. In the Templates section, note that this theme includes two Label templates: Optional Label with Help and Required Label with Help.

The Required with Help label template prepends a yellow asterisk to the left of the item label. You can change the appearance of an item by selecting another template.

To change to a different label template:

Go to the Page Definition for page 2.

Under Items, select an item.

Scroll down to Label and make a selection from the Template list.

Click Apply Changes.

Run the page.

Changing Buttons

The wizard that created the form in this tutorial also created buttons. These buttons display conditionally based upon whether the page is being used to create a new record (that is, P2_EMP_ID equals null), or the page is being used to update an existing record. These buttons were created as HTML buttons and positioned at the top of the region.

You can also position buttons at the bottom of the region, to the left or right of the page title, above the region, below the region, or in any button position defined in the region template.

To change a button position:

Go to the Page Definition for page 2.

Under Buttons, click the Edit All icon in the Buttons section. The Edit All icon resembles a small grid with a pencil on top of it.

Make a new selection from the Position column.

Click Apply Changes.

Run the page.

Buttons can also have templates associated with them to refine how they look.

Running the Page for Update

You can run the page and provide it with an Employee ID to retrieve. Typically, this would be done with a link from a report page; but for this example, run the page and add P2_EMP_ID:1 to the end of the URL as shown in the following example:

http://apex.oracle.com/pls/otn/f?p=9659:2:1284393467360777225::::P2_EMP_ID:1

This will pass the value 1 to the item P2_EMP_ID. If you run the page, note that the Delete and Apply Changes buttons now display as shown in Figure 5-22. The Create button appeared previously because the page was expecting a new record to be created. Also note that a value now appears in the Record Create Date field.

Figure 5-22 Revised Update Form

Description of Figure 5-22 follows
Description of "Figure 5-22 Revised Update Form"

See Also:

"Understanding URL Syntax" in Oracle Database Application Express User's Guide.

Making Data Bold

One way to make the information in a region easier to read is to make the labels (or the data) more pronounced. You can accomplish this by changing the color, specifying another font, or using bold. To make a label bold, you could bold the data manually, or create a new label template. In the latter approach, you would create a new label template that would wrap the HTML tag for bold around the label and then associate that template with the items in the Audit Information region.

To make data bold manually:

Go to the Page Definition for page 2.

Under Items, select an item name.

Scroll down to Element.

In HTML Form Element Attributes, enter:

class="fielddatabold"

This example references a class in the Cascading Style Sheet associated with this application.

Click Apply Changes.

Run the page.

6 How to Work with Check Boxes

In Oracle Application Express, you can create check boxes as items, or you can create check boxes in reports. Check boxes on a form work similarly to a list of values. When you define an item to be a check box, you need to provide the check box value in the List of Values section of the Item Attributes page. You define check boxes on a report using the supplied function, APEX_ITEM.CHECKBOX.

This tutorial illustrates different ways in which you can create check boxes and explains how to reference and process the values of checked boxes. Before you begin, you need to import and install the OEHR Sample Objects application in order to access the necessary sample database objects. See "About Loading Sample Objects".

This section contains the following topics:

Creating an Application

Editing the Update Form

Change the Report Display

Create Multi Value Check Boxes to Filter Content

Adding Check Boxes to Each Row in the Report

For additional examples on this and related topics, please visit the following Oracle by Examples (OBEs):

Creating and Running an Application

http://www.oracle.com/technology/obe/hol08/apexintro/apex3.1.1_b/apex3.1.1_b_otn.htm

Using Some Additional New Features in Oracle Application Express 3.1

http://www.oracle.com/technology/obe/apex/apex31nf/apex31misc.htm

Adding Additional Components to your Existing Application

http://www.oracle.com/technology/obe/hol08/apexintro/apex3.1.1_c/apex3.1.1_c_otn.htm

Creating an Application

First, you need to create an application using the Create Application Wizard.

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.

Click Create.

Select Create Application and click Next.

For Name:

Name - Enter Check Boxes.

Application - Accept the default.

Create Application - Select From scratch.

Schema - Select the schema where you installed the OEHR sample objects.

Click Next.

Next, you need to add a page. For this exercise, you add a report and form.

To add a report and form:

Select Page Type -Select Report and Form.

Table Name - Select OEHR_PRODUCT_INFORMATION.

Click Add Page.

Two new pages appear in the list at the top of the page. Note that each page has the same page name. Next, edit the page names to make them more meaningful.

To edit the name of page 1:

Click OEHR_PRODUCT_INFORMATION next to page 1 at the top of the page as shown in Figure 6-1.

Figure 6-1 Page Name in the Create Application Wizard

Description of Figure 6-1 follows
Description of "Figure 6-1 Page Name in the Create Application Wizard"

In Page Name, replace the existing text with Product Report.

Click Apply Changes.

To edit the name of page 2:

Click OEHR_PRODUCT_INFORMATION next to page 2 at the top of the page as shown in Figure 6-1.

In Page Name, replace the existing text with Update Form.

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 Preference Derived From and click Next.

For User Interface, select Theme 2 and click Next.

Review your selections and click Create.

The Application home page appears.

Run the Application

Next, review the application by running it.

To run the application:

Click Run Application as shown in Figure 6-2.

Figure 6-2 Run Application Icon

Description of Figure 6-2 follows
Description of "Figure 6-2 Run Application Icon"

If prompted to enter a user name and password, enter your workspace user name and password and click Login. See "About Application Authentication".

The application appears. Note that the report contains eleven columns displaying product information. Users can link to an update form by clicking the Edit icon in the far left column.

Click the Edit icon next to a specific product. As shown in Figure 6-3, an update form appears.

Figure 6-3 Update Form

Description of Figure 6-3 follows
Description of "Figure 6-3 Update Form"

Editing the Update Form

Page 2 of your application is an update form. In this exercise, you modify this form by hiding the Warranty Period field and creating a new check box.

Topics in this section include:

Hide the Warranty Period Field

Add a New Checkbox

Hide the Warranty Period Field

First, hide the Warranty Period field by changing the Display As attribute.

To hide the Warranty Period field:

Click Edit Page 2 on the Developer toolbar.

The Page Definition for page 2 appears.

Scroll down to the Items section.

Under Items, select P2_WARRANTY_PERIOD.

From Display As in the Name section, select Hidden.

Click Apply Changes.

Add a New Checkbox

In this exercise you create a check box that automatically sets the minimum product price to 75% of the list price.

Topics in this section include:

Add a New Item

Create a Process

Edit the Item to Display as a Check Box

Tip:

For simplicity, this tutorial has you create a checkbox by editing item attributes. As a best practice, however, you can also create a named LOV and reference it.

See Also:

"Creating Lists of Values" in Oracle Database Application Express User's Guide

Add a New Item

First, you add a new item. Initially, you create this item to display as a radio group and later change it to a check box.

To add an item that displays as a radio group:

On the Page Definition for page 2, scroll down to Items.

Under Items, click the Create icon as shown in Figure 6-4.

Figure 6-4 Create Icon

Description of Figure 6-4 follows
Description of "Figure 6-4 Create Icon "

For Item Type, select Radio and click Next.

For Radio Group Control Type, select Radio group and click Next.

For Display Position and Name:

Item Name - Enter P2_SET_MIN_PRICE.

Sequence - Enter 9.5.

Note that this sequence positions the item below the P2_MIN_PRICE item (the Minimum Price field).

Region - Select Update Form.

Click Next.

For List of Values:

Named LOV - Select Select Named LOV.

Display Null Option - Select No.

List of Values Query - Enter:

STATIC:Yes;Y,No;N

Click Next.

For Item Attributes:

Label - Replace the existing text with Set Minimum Price.

Accept the remaining defaults.

Click Next.

For Source:

Item Source - Select SQL Query.

Item Source Value - Enter:

SELECT 'Y' FROM DUAL WHERE :P2_LIST_PRICE*0.75=:P2_MIN_PRICE

Accept the remaining defaults and click Create Item.

Create a Process

Next, you create a page process that sets the minimum price at a 25% discount of the list price.

To create a page process:

On the Page Definition for page 2, locate the Page Processing area.

Under Processes, click the Create icon.

For Process Type, select PL/SQL and click Next.

For Process Attributes:

Name - Enter Update Min Price.

Sequence - Accept the default.

Point - Select OnSubmit - After Computations and Validataions.

Click Next.

For Process:

Enter the following:

UPDATE oehr_product_information
SET MIN_PRICE=(:P2_LIST_PRICE*0.75)
WHERE PRODUCT_ID=:P2_PRODUCT_ID;

Click Next.

For Messages:

Success Message - Enter:

Product successfully updated.

Failure Message - Enter:

Unable to update this product. Contact your system administrator.

Click Next.

For Process Conditions:

Condition Type - Select Value of Item in Expression 1 = Expression 2.

Expression 1 - Enter:

P2_SET_MIN_PRICE

Expression 2 - Enter Y.

Click Create Process.

Run the Page

To run the page:

Click the Run Page icon in the upper right corner.

If prompted to enter a user name and password, enter your workspace user name and password and click Login. See "About Application Authentication".

The revised form appears as shown in Figure 6-5. Note that the Warranty Period field no longer displays and a new Set Minimum Price radio group appears.

Figure 6-5 Update Form with Set Minimum Price Radio Group

Description of Figure 6-5 follows
Description of "Figure 6-5 Update Form with Set Minimum Price Radio Group"

Edit the Item to Display as a Check Box

Next, change the Set Minimum Price radio group (P2_SET_MIN_PRICE) to display as a check box.

To edit P2_SET_MIN_PRICE:

Click Edit Page 2 on the Developer toolbar.

The Page Definition for Page 2 appears.

Under Items, click P2_SET_MIN_PRICE.

From Display As, select Checkbox.

Scroll down to Label. In Label, delete the existing text, Set Minimum Price.

Scroll down to Default. In Default Value, enter N.

Under Lists of Values:

Number of Columns - Enter 1.

List of values definition - Enter:

STATIC: <b> Set Minimum Price</b><br/> (25% Discount on List Price);Y

Click Apply Changes at the top of the page.

Run the Page

To run the page, click the Run Page icon in the upper right corner. The revised form appears as shown in Figure 6-6. Note the new Set Minimum Price check box.

Figure 6-6 Update Form with Set Minimum Price Check Box

Description of Figure 6-6 follows
Description of "Figure 6-6 Update Form with Set Minimum Price Check Box"

Change the Report Display

You can alter how a report displays by editing report attributes. In the exercise, you change the number of columns that display on page 1 and then change the format of two columns to include a currency symbol.

To edit report attributes for page 1:

Click Application on the Developer toolbar.

The Application home page appears.

Click 1 - Product Report.

The Page Definition for page 1 appears.

Under Regions, click the Report link as shown in Figure 6-7.

Figure 6-7 Report Link

Description of Figure 6-7 follows
Description of "Figure 6-7 Report Link"

The Report Attributes page appears. You can use this page to precisely control the report layout. First, change the number of columns that display.

Deselect the Show check box for the following columns:

Weight Class

Warranty Period

Supplier ID

Next, edit List Price and Min Price columns to include a currency symbol.

Edit the List Price column:

Click the Edit icon next to List Price.

From Number / Date Format, select $5,234.10.

Click the Next (>) icon at the top of the page.

Clicking the Next icon submits your changes and then displays attributes for the next column, Min Price.

Edit the Min Price column:

From Number / Date Format, select $5,234.10.

Note that you select a format by selecting an example. However, the value that actually displays field is the Oracle number format.

Click Apply Changes.

Click the Run Page icon in the upper right corner.

The revised report appears. Notice the Weight Class, Warranty Period, and Supplier ID no longer appear and the List Price and Min Price columns include a currency symbol.

Create Multi Value Check Boxes to Filter Content

In the next exercise, you change the Search field (P1_REPORT_SEARCH) on the Product Report page to a multi value check box. These check boxes enable users to filter the report by product category (obsolete, orderable, planned, under development).

Topics in this section include:

Change the Search Field to a Multi Value Check Box

Edit the Report Region Definition

Change the Default Check Box Behavior

Change the Check Boxes to Display in Bold

Change the Search Field to a Multi Value Check Box

To change the search field to a check box:

Click Edit Page 1 on the Developer toolbar.

The Page Definition for page 1 appears.

Under Items, click P1_REPORT_SEARCH.

From Display As, select Checkbox.

Scroll down to Label. For Label, delete the existing text and replace with Product Status.

Scroll down to Source. In Source Value or Expression, enter:

obsolete:orderable:planned:under development

Scroll down to List of Values. Specify the following:

Named LOV - Accept the default.

Number of Columns - Enter 4.

List of values definition - Enter:

SELECT DISTINCT product_status display_value, product_status return_value
FROM oehr_product_information
ORDER BY 1

Note:

Note that to create a multi value check box, the List of Values query must return more than one row.

Click Apply Changes at the top of the page.

The Page Definition for page 1 appears.

Edit the Report Region Definition

To edit the report region definition:

Under Regions, click Product Report.

The Region Definition appears.

Scroll down to Source.

In Source modify the WHERE clause to read as follows:

...
WHERE  instr(':'||:P1_REPORT_SEARCH||':',product_status)> 0

Click Apply Changes at the top of the page.

The Page Definition for page 1 appears.

Click Apply Changes at the top of the page.

The Page Definition for page 1 appears.

Change the Default Check Box Behavior

Although the Product Status check boxes correctly filter the content on page 1, if you deselect all the check boxes, notice the report returns all products. This behavior results from the fact that if a check box has a NULL value (that is, it is deselected), then it defaults to the default value Y. The default value of Y, in turn, enables the check box.You can alter this behavior by adding a computation that remembers the state of the check box.To add a computation that tracks the state of the check box:

Under Page Processing, Computations, click the Create icon.

The Create Page Computation Wizard appears.

For Item Location, select Item on This Page and click Next.

For Item, specify the following:

Compute Item - Select P1_REPORT_SEARCH.

Sequence - Accept the default.

Computation Point - Select After Submit.

Computation Type - Select Static Assignment.

Click Next.

In Computation:

Enter:

none(bogus_value)

Click Next.

For Condition:

From Condition Type, select Value of Item in Expression 1 Is NULL.

In Expression 1, enter:

P1_REPORT_SEARCH

Click Create.

The Page Definition for page 1 appears.

Click the Run Page icon in the upper right corner. Note that the Product Status check boxes display at the top of the page.

Change the Check Boxes to Display in Bold

Next, you edit the check box display values (or labels) so that they appear as bold text.

To edit check box display values (or labels) to appear in bold:

Go to the Page Definition for page 1.

Under Items, click P1_REPORT_SEARCH.

Scroll down to Element.

In Form Element Option Attributes, enter:

class="fielddatabold"

Form Element Option Attributes are used exclusively for check boxes and radio buttons and control the way the Application Express engine renders individual options.

Click Apply Changes.

The Page Definition for page 1 appears.

Adding Check Boxes to Each Row in the Report

In the next exercise, you add a delete check box to each row in the Product Report. To accomplish this, you must edit the report query and make a call to the APEX_ITEM package.

APEX_ITEM is a supplied package for generating certain items dynamically. In this instance, you use APEX_ITEM.CHECKBOX to generate check boxes in the Product report. When the page is submitted, the values of the check boxes are stored in global package arrays. You can reference these values using the PL/SQL variables APEX_APPLICATION.G_F01 to APEX_APPLICATION.G_F50 based on the p_idx parameter value that was passed in.

Topics in this section include:

Call APEX_ITEM.CHECKBOX

Add a Button to Submit Check Box Array Values

Add a Process

See Also:

"APEX_ITEM" in Oracle Database Application Express User's Guide

Call APEX_ITEM.CHECKBOX

To edit the query to call APEX_ITEM.CHECKBOX:

Go to the Page Definition for page 1.

Under Regions, click Product Report.

Scroll down to Source.

In Region Source, add the new line appearing in bold face to the query.

SELECT
"product_id",
apex_item.checkbox(1,product_id) del,
"product_name",
"product_description",
"category_id",
"weight_class",
"warranty_period",
"supplier_id",
"product_status",
"list_price",
"min_price",
"catalog_url"
FROM   "oehr_product_information"
WHERE  instr(':'||:p1_report_search||':',product_status)> 0

APEX_ITEM is an Oracle Application Express supplied package that you can use to generate certain items dynamically. Note that the value passed in for p_idx in the above example is 1. You reference the check box values using the global variable APEX_APPLICATION.G_F01 later on.

Oracle Application Express automatically adds new columns to the end of the column list. Next, you need to move the DEL column.

Scroll to the top of the page and select the Report Attributes tab.

Under Column Attributes, locate the Del column.

Click the Up arrow on the far right until the DEL column is directly below PRODUCT_ID. (See Figure 6-8).

Figure 6-8 Report Column Attributes Page

Description of Figure 6-8 follows
Description of "Figure 6-8 Report Column Attributes Page"

Click Apply Changes.

The Page Definition for page 1 appears.

Add a Button to Submit Check Box Array Values

To add a button to submit the check box array values:

Go to the Page Definition for page 1.

Under Buttons, click the Create icon.

For Button Region, select Product Report (1) and click Next.

For Position, select Create a button in a region position and click Next.

For Button Attributes:

Button Name - Enter DELETE_PRODUCTS.

Label - Enter Delete Products.

Accept the remaining defaults and click Next.

In Button Template, accept the default selection and click Next.

For Display Properties:

Position - Select Top of Region.

Accept the remaining defaults and click Next.

For Branching, select 1 Product Report and click Create Button.

Add a Process

To add a process that executes when the user clicks the Delete Products button:

Under Page Processing, Processes, click the Create icon.

For Process Type, select PL/SQL and click Next.

For Process Attributes:

Name - Enter Delete Products.

Sequence - Accept the default.

For Point - Select On Submit - After Computations and Validations.

Click Next.

Enter the following PL/SQL process and then click Next:

FOR i in 1..APEX_APPLICATION.G_F01.count
LOOP
   DELETE FROM oehr_product_information
   WHERE product_id = APEX_APPLICATION.G_F01(i);
END LOOP;

APEX_ITEM is an Oracle Application Express supplied package that you can use to generate certain items dynamically. When a page is submitted, the values of each column are stored in global package arrays, which you can reference using the PL/SQL variable APEX_APPLICATION.G_F01 to APEX_APPLICATION.G_F50. In this exercise, the value passed in for product_id is 1, so you reference the column values using the global variable APEX_APPLICATION.G_F01.

On Messages:

In Success Message, enter:

Product(s) deleted.

In Failure Message, enter:

Unable to delete product(s).

Click Create Process.

Run the page.

Notice that the Delete Products button appears above the report as shown in Figure 6-9. To remove a product from the report, select the Del check box and then click Delete Products.

Figure 6-9 Product Report with Delete Products Check Box

Description of Figure 6-9 follows
Description of "Figure 6-9 Product Report with Delete Products Check Box"

7 How to Implement a Web Service

Web services enable applications to interact with one another over the Web in a platform-neutral, language independent environment. In a typical Web services scenario, a business application sends a request to a service at a given URL by using the HTTP protocol. The service receives the request, processes it, and returns a response. You can incorporate calls to external Web services in applications developed in Oracle Application Express.

Web services in Oracle Application Express are based on SOAP (Simple Object Access Protocol). SOAP is a World Wide Web Consortium (W3C) standard protocol for sending and receiving requests and responses across the Internet. SOAP messages can be sent back and forth between a service provider and a service user in SOAP envelopes.

Web services are called from within an Oracle Application Express application by:

Using the Universal Description, Discovery, and Integration (UDDI) registry

Manually providing the WSDL URL

This tutorial illustrates the later method.

Topics in this section include:

About Creating Web Service References

Creating a New Application

Specifying an Application Proxy Server Address

Creating a Web Service Reference from a WSDL

Creating a Web Service Reference Manually

Note:

The SOAP 1.1 specification is a W3C note. (The W3C XML Protocol Working Group has been formed to create a standard that will supersede SOAP.)

For information about Simple Object Access Protocol (SOAP) 1.1 see:

http://www.w3.org/TR/SOAP/

See Also:

"Implementing Web Services" in Oracle Database Application Express User's Guide

About Creating Web Service References

To utilize Web services in Oracle Application Express, you create a Web service reference using a wizard. When you create the Web reference, you can follow one of these methods:

You supply the URL to a WSDL document. The wizard then analyzes the WSDL and collects all the necessary information to create a valid SOAP message.

The wizard provides a step where you can locate a WSDL using the Universal Description, Discovery, and Integration (UDDI) registry. A UDDI registry is a directory where businesses register their Web services. You search for the WSDL by entering either a service or business name.

You supply the relevant information on how to interact with the Web reference, including the SOAP request envelope, and create the Web reference manually.

This tutorial describes the second method, creating a Web service reference manually.

Creating a New Application

First, create a new application.

To create an application:

On the Workspace home page, click the Application Builder icon.

On the Application Builder home page, click Create.

For Method, select Create Application, and click Next.

For Name:

For Name - Enter Web Services.

Accept the remaining defaults and click Next.

Add a blank page:

Under Select Page Type, accept the default, Blank.

In Page Name, enter Web Services and then click Add Page.

The new page appears in the list at the top of the page.

Click Next.

For Tabs, accept the default, One Level of Tabs, and click Next.

For Shared Components, accept the default, No, and click Next.

For Attributes, accept the default for Authentication Scheme, Language, and User Language Preference Derived From and click Next.

For User Interface, select Theme 2 and click Next.

Review your selections and click Create.

The Application home page appears.

Specifying an Application Proxy Server Address

If your environment requires a proxy server to access the Internet, you must specify a proxy server address on the Application Attributes page before you can create a Web service reference.

To specify a proxy address:

On the Application home page, click Shared Components.

Under Application, click Definition.

Under Name, enter the proxy server in the Proxy Server field.

Click Apply Changes.

The Application home page appears.

Creating a Web Service Reference from a WSDL

In this exercise, you create a Web service by supplying the location of a WSDL document to a Web service. You then create a form and report for displaying movie theaters and locations.

Note:

The following exercise is dependent upon the availability of the specified Web service ultimately invoked. If the Web service is unavailable, you may experience difficulties completing this exercise.

To create a new Web reference by supplying the WSDL location:

On the Application home page, click Shared Components.

The Shared Components page appears.

Under Logic, select Web Service References.

Click Create

When prompted whether to search a UDDI registry to find a WSDL, select No and click Next.

In the WSDL Location field enter:

http://www.ignyte.com/webservices/ignyte.whatsshowing.webservice/moviefunctions.asmx?wsdl

Click Next.

A summary page appears describing the selected Web service.

Click Create Reference.

The Create Web Service Reference page appears. The Web service reference for MovieInformation is added to the Web Service References Repository.

Create a Form and Report

Next, you need to create a page that contains a form and report to use with your Web Service Reference.

To create a form and report after creating a Web Service Reference:

On the Create Web Service Reference success page, select Create Form and Report on Web Service.

For Choose Service and Operation:

Web Service Reference - Select MovieInformation.

Operation - Select GetTheatersAndMovies.

Click Next.

For Page and Region Attributes:

Form Region Title - Change to Theater Information.

Accept the other defaults and click Next.

For Input Items:

For P2_ZIPCODE and P2_RADIUS, accept the default, Yes, in the Create column.

For P2_ZIPCODE, change the Item Label default to ZIP Code.

Click Next.

For Web Service Results:

Temporary Result Set Name (Collection) - Accept the default.

Result Tree to Report On - Select Theater (tns:Theater).

Click Next.

For Result Parameters, select all the parameters and click Finish.

Click Run Page.

If prompted to log in, enter the user name and password for your workspace and click Login.

A form and report resembling Figure 7-1 appear. Notice that the Theater Information Form at the top of the page contains a data entry field and a submit button, but the Results Report does not contain any data.

Figure 7-1 Theater Information Form and Report without Data

Description of Figure 7-1 follows
Description of "Figure 7-1 Theater Information Form and Report without Data"

To test the form, enter 43221 in the ZIP Code field and 5 in the Radius field. Then click Submit.

The report at the bottom of the page should resemble Figure 7-2. The report lists the names and addresses of movie theaters matching the entered ZIP code and radius.

Figure 7-2 Theater Information Report Showing Resulting Data

Description of Figure 7-2 follows
Description of "Figure 7-2 Theater Information Report Showing Resulting Data"

Creating a Web Service Reference Manually

In this exercise, you create a Web reference by supplying information about the Web service and using the manual facility. Manual Web references are created by visually inspecting the WSDL document as well as using a tool to determine the SOAP envelope for the Web service request.

Topics in this section include:

Create a Web Service Reference Manually

Test the Web Service

Create a Page to Call the Manual Web Service

Create a Submit Button

Create Items for ZIP Code and Radius

Create a Process to Call the Manually Created Web Reference

Create a Report on the Web Service Result

Create a Web Service Reference Manually

To create a Web reference manually, you will copy code from the WSDL for a service called MovieInformation.

Please note the example settings provided in the following steps are based on the MovieInformation service at the time this document was released.

To create a manual Web reference:

On the Application home page, click Shared Components.

Under Logic, click Web Service References.

Click Create.

For Search UDDI, select No and click Next.

From the Tasks list on the right, click the Create Web Reference Manually link.

The Create/Edit Web Service page appears.

In the Name field, enter Movie Info.

Locate the endpoint of the MovieInformation service:

Open the WSDL by going to:

http://www.ignyte.com/webservices/ignyte.whatsshowing.webservice/moviefunctions.asmx?wsdl

In the WSDL, find the location attribute of the soap:address element, which is a child of the port element. You can search for the following term within the code: soap:address location.

At the time of this release, it was this attribute:

http://www.ignyte.com/webservices/ignyte.whatsshowing.webservice/moviefunctions.asmx

In the URL field on the Create/Edit Web Service page, enter the endpoint of the MovieInformation service you located. For example: http://www.ignyte.com/webservices/ignyte.whatsshowing.webservice/moviefunctions.asmx

Locate the SOAP action for the GetTheatersAndMovies operation:

If necessary, open the WSDL again. See Step 7a.

In the WSDL, find the soapAction attribute of the soap:operation element, which is a child of the operation element that has a name attribute of GetTheatersAndMovies. You can search for the following term within the code: soap:operation soapAction.

At the time of this release, it was this attribute:

http://www.ignyte.com/whatsshowing/GetTheatersAndMovies

In the Action field on the Create/Edit Web Service page, enter the SOAP action you located. For example: http://www.ignyte.com/whatsshowing/GetTheatersAndMovies

In the SOAP Envelope field on the Create/Edit Web Reference page, enter the xml code representing the SOAP Request message. For example:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tns="http://www.ignyte.com/whatsshowing"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <tns:GetTheatersAndMovies>
         <tns:zipCode>#ZIP#</tns:zipCode>
         <tns:radius>#RADIUS#</tns:radius>
      </tns:GetTheatersAndMovies>
   </soap:Body>
</soap:Envelope>

You can use a SOAP message generating tool, such as MindReef, to construct a valid SOAP Request for a given Web service.

In the Store Response in Collection field, enter MOVIE_RESULTS. This is where the response from the Web service will be stored.

The Create/Edit Web Service page should resemble Figure 7-3.

Figure 7-3 Create/Edit Web Service Page

Description of Figure 7-3 follows
Description of "Figure 7-3 Create/Edit Web Service Page"

Click Create.

The Web Service References page appears, showing Movie Info in the list.

Test the Web Service

To test the Web service:

On the Web Service References page, click the Test icon next to the Movie Info Web reference.

The Web Services Testing page appears.

Note View must be set to Details, otherwise the Test icon is not displayed.

In the SOAP Envelope field, replace #ZIP# with 43221 and #RADIUS# with 5.

Click Test.

Review the Result field and note the following about the response:

The base node in the return envelope is called:

GetTheatersAndMoviesResponse

The namespace for the message is:

http://www.ignyte.com/whatsshowing

The XPath to the interesting parts of the response under the result element is:

/GetTheatersAndMoviesResponse/GetTheatersAndMoviesResult/Theater/Movies/Movie

The interesting elements in the results are called:

Name
Rating
RunningTime
ShowTimes

Create a Page to Call the Manual Web Service

Next, you want to create a page to call the manual Web Service.

To create a page to call the manual Web service:

Click the Application breadcrumb link.

On the Application home page, click Create Page.

For Page, select Blank Page and click Next.

Accept the default for the Page Number and click Next.

In Name, enter Find Movies and click Next.

For Tabs, accept the default, No, and click Next.

Click Finish.

On the Success page, click Edit Page.

On the Page Definition, locate the Regions section.

Click the Create icon.

For Region, select HTML and click Next.

Select HTML as the HTML region container and click Next.

In the Title field, enter Movie Information and click Next.

Click Create Region.

Create a Submit Button

Next, you want to add a Submit button to the region to initiate a search from the page.

To create a Submit button:

On the Page Definition, click the Create icon in the Buttons section.

For Button Region, accept the default, Movie Information, and click Next.

For Button Position, accept the default, Create a button in a region position, and click Next.

For Button Attributes, enter SUBMIT in the Button Name and click Next.

For Button Template, accept the default, Button, and click Next.

For Display Properties, select Region Template Position #CREATE# from the Position list and click Next.

In the Branch to Page field, select Find Movies from the list. The page number appears in the field.

Click Create Button.

Create Items for ZIP Code and Radius

Next, you want to create two items where users can enter a search term.

To create the ZIP Code item:

On the Find Movies Page Definition, click the Create icon in the Items section.

For Item Type, select Text and click Next.

For Text Control Display Type, accept the default, Text Field, and click Next.

For Display Position and Name, specify the following:

Item Name - Enter ZIP.

The Movie Info Web Service Reference defines the zip code sent in the SOAP Request as #ZIP#. Therefore, this Item Name must be ZIP in order for it's value to be substituted into the SOAP Request sent to the Web Service.

Region - Accept the default, Movie Information.

Click Next.

In the Label field, replace the existing text with ZIP Code and click Next.

Click Create Item.

To create the Radius item:

On the Find Movies Page Definition, click the Create icon in the Items section.

For Item Type, select Text and click Next.

For Text Control Display Type, accept the default, Text Field, and click Next.

For Display Position and Name, specify the following:

Item Name - Enter RADIUS.

The Movie Info Web Service Reference defines the radius sent in the SOAP Request as #RADIUS#. Therefore, this Item Name must be RADIUS in order for it's value to be substituted into the SOAP Request sent to the Web Service.

Region - Accept the default, Movie Information.

Click Next.

In the Label field, enter Radius and click Next.

Click Create Item.

Create a Process to Call the Manually Created Web Reference

Next, you want to create a process that calls the manually created Web reference.

To create a process to call the manually created Web reference:

On the Find Movies Page Definition, click the Create icon in the Processes section.

For Process Type, select Web Services and click Next.

In the Name field, enter Call Movie Info and click Next.

From the Web Service Reference list, select Movie Info and click Next.

In the Success Message area, enter Called Movie Info.

In the Failure Message area, enter Error calling Movie Info and click Next.

From the When Button Pressed list, select SUBMIT and click Create Process.

Create a Report on the Web Service Result

Next, you want to add a report that displays the results of the called Web service.

To create a report on the Web service result:

On the Find Movies Page Definition, click the Create icon in the Regions section.

Select Report and click Next.

For Region, select Report on collection containing Web service result and click Next.

In the Title field, enter Search Results and click Next.

For Web Reference Type, select Manually Created and click Next.

For Web Reference Information, specify the following:

Web Service Reference - Select Movie Info from the list.

SOAP Style - Select Document.

Message Format - Select Literal.

Note that these two attributes can be determined by manually inspecting the WSDL document for the service.

Result Node Path - Enter:

/GetTheatersAndMoviesResponse/GetTheatersAndMoviesResult/Theater/Movies/Movie

Message Namespace - Enter:

http://www.ignyte.com/whatsshowing

Note that you reviewed both the Result Node Path and Message Namespace when testing the service.

Click Next.

In the first four Parameter Names, enter Name, Rating, RunningTime, and ShowTimes, and click Create SQL Report.

To test the page:

Click Run Page. If prompted to log in, enter your workspace user name and password. The Movie Information form appears, as shown in Figure 7-4.

Figure 7-4 Movie Information Form with No Data

Description of Figure 7-4 follows
Description of "Figure 7-4 Movie Information Form with No Data"

In the ZIP Code and Radius fields, enter information and click Submit.

The results appear in the Search Results area.

8 How to Create a Stacked Bar Chart

A stacked bar chart displays the results of multiple queries stacked on top of one another, either vertically or horizontally. Using a stacked bar chart is an effective way to present the absolute values of data points represented by the segments of each bar, as well as the total value represented by data points from each series stacked in a bar.

Although Application Builder includes built-in wizards for generating HTML, Scalable Vector Graphics (SVG), and Flash charts, only SVG and Flash charts support stacked bar charts.

This tutorial describes how to create a Flash stacked bar chart. Before you begin, you need to import and install the OEHR Sample Objects application in order to access the necessary sample database objects. See "About Loading Sample Objects".

This section contains the following topics:

About the Syntax for Creating Chart Queries

Creating an Application

Creating a New Page

Adding Additional Series

Updating the Sample Data

Viewing the Chart

Editing Chart Attributes

See Also:

"Creating Charts" in Oracle Database Application Express User's Guide

For additional examples on this and related topics, please visit the following Oracle by Examples (OBEs):

Using Some Additional New Features in Oracle Application Express 3.1

http://www.oracle.com/technology/obe/apex/apex31nf/apex31misc.htm

Adding Additional Components to your Existing Application

http://www.oracle.com/technology/obe/hol08/apexintro/apex3.1.1_c/apex3.1.1_c_otn.htm

About the Syntax for Creating Chart Queries

The syntax for the select statement of a chart is:

SELECT link, label, value
FROM   ...

Where:

link is a URL. This URL will be called if the user clicks on the that point on the resulting chart.

label is the text that displays in the bar.

value is the numeric column that defines the bar size.

You must have all three items in your select statement. In the next example, the link is defined as null because there is no appropriate page to link to.

For example:

SELECT null link,
       last_name label,
       salary value
FROM   employees
WHERE  DEPARTMENT_ID = :P101_DEPARTMENT_ID

See Also:

"Creating Charts" in Oracle Database Application Express User's Guide

Creating an Application

First, you create an application using the Create Application Wizard.

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.

Click Create.

Select Create Application and click Next.

For Name:

Name - Enter Bar Chart.

Application - Accept the default.

Create Application - Select From scratch.

Schema - Select the schema where you installed the OEHR sample objects.

Click Next.

Next, you need to add a page. 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 add a blank page.

Add a blank page:

Under Select Page Type, select Blank and click Add Page.

The new page appears in the list at the top of the page.

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 Preference Derived From and click Next.

For User Interface, select Theme 2 and click Next.

Review your selections and click Create.

The Application home page appears.

Creating a New Page

To create your chart, you can either add a region to an existing page and define it as a stacked bar chart, or you can create a new page. In this exercise, you create a new page within the Bar Chart application you just created.

The chart will display the sum for sales by product category. It will contain sales for the twelve months prior to the current month. In the following exercise, you use a wizard to create the chart and the first query. Then, you add additional queries (or series) for other product categories to make it stacked.

See Also:

"About the Syntax for Creating Chart Queries"

To create a new page:

On the Application home page, click Create Page.

For page, select Chart and click Next.

Select Flash Chart and click Next.

For Page Attributes:

For Page Number, enter 2.

For Page Name, enter Revenue by Category.

For Region Template, accept the default.

For Region Name, enter Revenue by Category.

For Breadcrumb, accept the default.

Click Next.

For Tab Options, accept the default, Do not use Tabs, and then click Next.

The Chart Preview appears. Use Chart Preview to configure chart attributes. Click Update to refresh the preview image.

On Chart Preview, specify the following:

Chart Type - Select Stacked 3D Column.

Show Legend - Select Right.

Click Update.

Notice the changes to the preview.

Click Next.

For Query:

Enter the following query:

SELECT NULL link,
       sales_month value,
       revenue "Hardware"
   FROM (
SELECT TO_CHAR(o.order_date,'Mon YY') sales_month,
       SUM(oi.quantity * oi.unit_price) revenue,
       TO_DATE(to_char(o.order_date,'Mon YY'),'Mon YY') sales_month_order
  FROM OEHR_PRODUCT_INFORMATION p,
       OEHR_ORDER_ITEMS oi,
       OEHR_ORDERS o,
       OEHR_CATEGORIES_TAB ct
 WHERE o.order_date <= (trunc(sysdate,'MON')-1)
   AND o.order_date > (trunc(sysdate-365,'MON'))
   AND o.order_id = oi.order_id
   AND oi.product_id = p.product_id
   AND p.category_id = ct.category_id
   AND ct.category_name like '%hardware%'
GROUP BY TO_CHAR(o.order_date,'Mon YY')
ORDER BY sales_month_order
)

The value label (in this instance, Hardware) is displayed in the legend of stacked charts.

Tip:

You can also create a chart query interactively by clicking the Build Query button.

For When No Data Found Message, enter:

No orders found in the past 12 months.

Click Next.

Review your selections and click Finish.

The Success page appears.

Adding Additional Series

Now that you have created a page with a region defining the query, you need to add additional series. In the following exercise, you add a series for the categories software and office equipment.

To add additional series:

On the Success Page, click Edit Page.

The Page Definition for page 2 appears.

Under Regions, click Flash Chart next to Revenue by Category.

The Flash Chart page appears with the Chart Attributes tab selected. Scroll down to Chart Series. Note that only one series appears.

To change the name the existing series:

Click the Edit icon.

In Series Name, enter Hardware.

Click Apply Changes.

Add a chart series for software:

Scroll down to Chart Series and then click Add Series.

For Series Name, enter Software.

Scroll down to Series Query.

In SQL, enter:

SELECT NULL link,
       sales_month value,
       revenue "Software"
   FROM (
SELECT TO_CHAR(o.order_date,'Mon YY') sales_month,
       SUM(oi.quantity * oi.unit_price) revenue,
       TO_DATE(to_char(o.order_date,'Mon YY'),'Mon YY') sales_month_order
  FROM OEHR_PRODUCT_INFORMATION p,
       OEHR_ORDER_ITEMS oi,
       OEHR_ORDERS o,
       OEHR_CATEGORIES_TAB ct
 WHERE o.order_date <= (trunc(sysdate,'MON')-1)
   AND o.order_date > (trunc(sysdate-365,'MON'))
   AND o.order_id = oi.order_id
   AND oi.product_id = p.product_id
   AND p.category_id = ct.category_id
   AND ct.category_name like '%software%'
GROUP BY TO_CHAR(o.order_date,'Mon YY')
ORDER BY sales_month_order
)

The value label (in this instance, Software) is displayed in the legend of stacked charts. Note that this SQL matches the previous series. The only difference is the category in the WHERE clause.

For When No Data Found Message, enter:

No orders found in the past 12 months.

At the top of the page, click Apply Changes.

Add a chart series for office equipment:

Under Chart Series, click Add Series.

For Series Name, enter Office Equipment.

Scroll down to Series Query.

In SQL, enter:

SELECT NULL link,
       sales_month value,
       revenue "Office Equipment"
   FROM (
SELECT TO_CHAR(o.order_date,'Mon YY') sales_month,
       SUM(oi.quantity * oi.unit_price) revenue,
       TO_DATE(to_char(o.order_date,'Mon YY'),'Mon YY') sales_month_order
  FROM OEHR_PRODUCT_INFORMATION p,
       OEHR_ORDER_ITEMS oi,
       OEHR_ORDERS o,
       OEHR_CATEGORIES_TAB ct
 WHERE o.order_date <= (trunc(sysdate,'MON')-1)
   AND o.order_date > (trunc(sysdate-365,'MON'))
   AND o.order_id = oi.order_id
   AND oi.product_id = p.product_id
   AND p.category_id = ct.category_id
   AND ct.category_name like '%office%'
GROUP BY TO_CHAR(o.order_date,'Mon YY')
ORDER BY sales_month_order
)

The value label (in this instance, Office Equipment) is displayed in the legend of stacked charts.

For When No Data Found Message, enter:

No orders found in the past 12 months.

Scroll up to the top of the page and click Apply Changes.

Updating the Sample Data

The sample data that installed with the OEHR Sample Objects application is not current. To make the data current, you need to update the dates in the sample data. You will accomplish this by running an update statement in SQL Commands

See Also:

"Using SQL Commands" in Oracle Database Application Express User's Guide

To update the dates in the seed data:

Return to the Workspace home page. Click the Home breadcrumb link at the top of the page.

On the Workspace home page, click SQL Workshop and then SQL Commands.

The SQL Commands page appears.

Enter the following in the SQL editor pane:

DECLARE
   l_date_offset  number;
BEGIN

FOR c1 IN (SELECT TRUNC(max(order_date)) max_date
             FROM oehr_orders)
LOOP
   l_date_offset := round(sysdate - c1.max_date);
END LOOP;
UPDATE oehr_orders
   set order_date = order_date + l_date_offset;
COMMIT;
END;
/

Click Run (Ctrl+Enter) to execute the command.

Viewing the Chart

Now that the chart is complete, you can view it.

To run the chart:

Return to page 2, Revenue by Category:

Click the Home breadcrumb link at the top of the page.

Click Application Builder and then click your Bar Chart application.

Click 2 - Revenue by Category.

Click the Run Page icon in the upper right corner of the page.

If prompted for a user name and password, enter your workspace user name and password and click Login. See "About Application Authentication".

Your bar chart should resemble Figure 8-1.

Figure 8-1 Revenue by Category Stacked Bar Chart

Description of Figure 8-1 follows
Description of "Figure 8-1 Revenue by Category Stacked Bar Chart"

The chart displays the revenue for each product category by month. A legend that defines the color associated with each product appears at the top of the page. Note that the text in X Axis is spaced too closely together. In the next section, you edit the chart attributes to correct this issue.

Editing Chart Attributes

In this exercise, you change the appearance of your chart by editing chart attributes.

To edit chart attributes:

Click Edit Page 2 on the Developer toolbar.

Under Regions, click Flash Chart.

The Chart Attributes page appears.

Under Chart Settings, edit the chart width. In Chart Width, enter 800.

Scroll down to Display Settings. From Animation, select Dissolve.

Scroll down to Axes Settings. From Show Group Separator, select Yes.

Scroll down to Font Settings. For X Axis Title, select the Font Size 10.

Click Apply Changes to a the top of the page.

Click the Run Page icon in the upper right corner of the page.

You chart should resemble Figure 8-2.

Figure 8-2 Revised Stacked Bar Chart

Description of Figure 8-2 follows
Description of "Figure 8-2 Revised Stacked Bar Chart"

Note that the chart displays on-screen gradually using a dissolve and the X Axis displays correctly.

9 How to Upload and Download Files in an Application

Oracle Application Express applications support the ability to upload and download files stored in the database. This tutorial illustrates how to create a form and report with links for file upload and download, how to create and populate a table to store additional attributes about the documents, and finally how to create the mechanism to download the document in your custom table.

This section contains the following topics:

Creating an Application

Creating an Upload Form

Creating a Report with Download Links

Storing Additional Attributes About the Document

Storing the Document in a Custom Table

Downloading Documents from the Custom Table

Security Issues to Consider

For additional examples on this topic, please visit the following Oracle by Examples (OBEs):

Defining and Viewing BLOB Data in Oracle Application Express 3.1

http://www.oracle.com/technology/obe/apex/apex31nf/apex31blob.htm

Creating an Application

First, create a new application using the Create Application Wizard with the assumption you will include an upload form on page 1.

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.

Click Create.

Select Create Application and then click Next.

For Name, specify the following:

For Name, enter Download App.

Accept the remaining defaults and click Next.

Add a blank page:

Under Select Page Type, select Blank and click Add Page.

The new page appears in the Create Application list at the top of the page.

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 Preference Derived From and click Next.

For User Interface, select Theme 2 and then click Next.

Review your selections and click Create.

The Application home page appears.

Creating an Upload Form

Once you create an application, the next step is to create a form to upload documents. In the following exercise, you create a form in an HTML region that contains a file upload item and a button. The button submits the page and returns the user to the same page.

Topics in this section include:

Create an HTML Region

Create an Upload Item

Create a Button

Create an HTML Region

First, you need to create a container to hold the form. In Application Builder, this container is called a region.

To create an HTML region:

Click the Page 1 icon.

The Page Definition appears.

Under Regions, click the Create icon as shown in Figure 9-1.

Figure 9-1 Create Icon

Description of Figure 9-1 follows
Description of "Figure 9-1 Create Icon "

For Region:

Identify the type of region to add to this page - Accept the default, HTML, and click Next.

Select the type of HTML region container you wish to create - Accept the default, HTML, and click Next.

For Display Attributes:

Title - Enter Submit File.

Accept the remaining defaults and click Next.

Accept the remaining defaults and click Create Region.

The Page Definition appears.

Create an Upload Item

Next, you need to create a text field or item. In Application Builder, an item is part of an HTML form. An item can be a text field, text area, password, select list, check box, and so on. In this exercise, you will create a File Browse item. When you create a File Browse item, files you upload are stored in a table named wwv_flow_file_objects$.

To create a file upload item:

Under Items on the Page Definition for page 1, click the Create icon.

For Item Type, select File Browse and then click Next.

For Display Position and Name:

Item Name - Enter P1_FILE_NAME.

For Sequence, accept the default.

For Region, select Submit File.

Click Next.

Accept the remaining defaults and click Next.

Click Create Item.

The Page Definition appears.

Create a Button

Next, you need to create a button to submit the file.

To create a button:

Under Buttons, click the Create icon.

For Button Region, select Submit File (1) 1 and click Next.

For Button Position, select Create a button in a region position and then click Next.

On Button Attributes:

Button Name - Enter Submit.

Accept the remaining defaults.

Click Next.

For Button Template, accept the default and click Next.

For Display Properties, accept the defaults and click Next.

For Branching:

Branch to Page - Select Page 1.

This selection causes the page to call itself on submit rather than navigate to another page.

Click Create Button.

Run the page by clicking the Run Page icon as shown in Figure 9-2.

Figure 9-2 Run Page Icon

Description of Figure 9-2 follows
Description of "Figure 9-2 Run Page Icon"

If prompted to enter a user name and password, enter your workspace user name and password and click Login. See "About Application Authentication".

When you run the page, it should look similar to Figure 9-3.

Figure 9-3 Submit File Form

Description of Figure 9-3 follows
Description of "Figure 9-3 Submit File Form"

Creating a Report with Download Links

Once you create the form to upload documents, the next step is to create a report on the document table that contains links to the uploaded documents. When you use a File Browse item, the files you upload are stored in a table called wwv_flow_file_objects$. Every workspace has access to this table through a view called APEX_APPLICATION_FILES.

Topics in this section include:

Create a Report on APEX_APPLICATION_FILES

Add Link to Download Documents

Create a Report on APEX_APPLICATION_FILES

To create a report on APEX_APPLICATION_FILES:

Click Edit Page 1 on the Developer toolbar at the bottom of the page.

The Page Definition appears.

Under Regions, click the Create icon.

For Region, select Report and then click Next.

For Report Implementation, select SQL Report and then click Next.

For Display Attributes:

Title - Enter Uploaded Files.

Accept the remaining defaults and click Next.

For Source, enter the following SQL query:

SELECT id,name FROM APEX_APPLICATION_FILES

Click Create Region.

Run the page.

Your report should resemble Figure 9-4. Note that your display may differ slightly depending on what files you have uploaded.

Figure 9-4 Uploaded Files Report

Description of Figure 9-4 follows
Description of "Figure 9-4 Uploaded Files Report"

Add Link to Download Documents

Next, you need to provide a link to download each document.

To provide a link to download the documents in the report:

Click Edit Page 1 on the Developer toolbar.

Under Regions, click Report next to Uploaded Files as shown in Figure 9-5.

Figure 9-5 Report Link

Description of Figure 9-5 follows
Description of "Figure 9-5 Report Link"

The Report Attributes page appears. You can add a link to the ID column by editing Column Attributes.

Under Column Attributes, click the Edit icon in the ID row.

Scroll down to Column Link.

Under Column Link:

Link Text - Select #ID#.

Target - Select URL.

In the URL field, enter the following:

p?n=#ID#

#ID# parses the value contained in the column where ID is the column alias.

At the top of the page, click Apply Changes.

Run the page.

When you run the page, it should look similar to Figure 9-6.

Figure 9-6 Uploaded Files Report with Download Links

Description of Figure 9-6 follows
Description of "Figure 9-6 Uploaded Files Report with Download Links"

To test the links, click an ID.

A File Download dialog box appears.

Click Edit Page 1 on the Developer toolbar to return to the Page Definition.

Storing Additional Attributes About the Document

Next, you create another table to store additional information about the documents that are uploaded. In this exercise, you:

Add an item to the upload form to capture the information

Add a process to insert this information along with the name of the file

Alter the SQL Report of uploaded files to join to the table containing the additional information

Topics in this section include:

Create a Table to Store Document Attributes

Create an Item to Capture the Document Subject

Create a Process to Insert Information

Show Additional Attributes in the Report Region

Create a Table to Store Document Attributes

First, you create a table in SQL Commands.

See Also:

"Using SQL Commands" in Oracle Database Application Express User's Guide

To create the table to store additional information about uploaded files:

Go to SQL Commands:

Click the Home breadcrumb link at the top of the page as shown in Figure 9-7.

Figure 9-7 Breadcrumb Menu

Description of Figure 9-7 follows
Description of "Figure 9-7 Breadcrumb Menu"

The Workspace home page appears.

On the Workspace home page, click SQL Workshop and then SQL Commands.

The SQL Commands page appears.

In the top section, enter:

CREATE TABLE oehr_file_subject
   (name     VARCHAR2(4000) primary key,
    subject  VARCHAR2(4000));

Click Run.

The message Table created appears in the Results section.

Click the Home breadcrumb link.

The Workspace home page appears.

Create an Item to Capture the Document Subject

To create an item to capture the subject of the document:

Go to the Page Definition for page 1:

On the Workspace home page, click the Application Builder icon.

On the Application Builder home page, click Download App.

On the Application home page, click the Page 1 icon.

The Page Definition for Page 1 appears.

Under Items, click the Create icon.

For Item Type, select Text and click Next.

For Text Control Display Type, select Text Field and click Next.

For Display Position and Name:

For Item Name - Enter P1_SUBJECT.

Sequence - Accept the default.

Region - Select Uploaded Files.

Click Next.

For Item Attributes:

Label field - Enter Subject.

Accept the remaining defaults.

Click Next.

Click Create Item.

Create a Process to Insert Information

Next, you need to create a process to insert the subject information into the new table.

To create a process:

Under Page Processing, Processes, click the Create icon.

For Process Type, select PL/SQL and then click Next.

For Process Attributes:

Name - Enter Insert file description.

Sequence- Accept the default.

From Point - Select On Submit - After Computations and Validations.

Click Next.

In Enter PL/SQL Page Process, enter the following:

INSERT INTO oehr_file_subject(name, subject) VALUES(:P1_FILE_NAME,:P1_SUBJECT);

Click Next.

For Messages:

Success Message - Enter:

Subject inserted

Failure Message - Enter:

Error inserting subject

Click Next.

For Process Conditions:

When Button Pressed - Select SUBMIT.

Accept the remaining defaults and click Create Process.

Show Additional Attributes in the Report Region

Finally, you need to alter the SQL Report region to join it to the additional attributes table. To accomplish this, you edit the Region Source attribute on the Region Definition page.

To edit the Region Source:

Under Regions, click Uploaded Files.

The Region Definition appears.

Scroll down to Source.

Replace the Region Source with the following:

SELECT w.id,w.name,s.subject
FROM APEX_APPLICATION_FILES w,oehr_file_subject s
WHERE w.name = s.name

Click Apply Changes.

Run the page.

Click Browse, locate a file to upload, and click Submit.

As shown in Figure 9-8, the Uploaded Files report now contains a Subject column.

Figure 9-8 Uploaded Files Report with Subject Column

Description of Figure 9-8 follows
Description of "Figure 9-8 Uploaded Files Report with Subject Column"

Click Edit Page 1 on the Developer toolbar to return to the Page Definition.

Storing the Document in a Custom Table

In certain cases, you may want to store uploaded documents in a table owned by your schema. For example, if you want to create an Oracle Text index on uploaded documents, you need to store the documents in a custom table.

To store documents in your custom table:

Add a column of type BLOB to hold the document

Alter the process to insert documents into the custom table

To add a BLOB column to the oehr_file_subject table:

Go to SQL Commands:

Click the Home breadcrumb link at the top of the page.

The Workspace home page appears.

On the Workspace home page, click SQL Workshop and then SQL Commands.

The SQL Commands page appears.

In the top section, enter the following SQL statement:

ALTER TABLE oehr_file_subject ADD(id number,blob_content BLOB,mime_type varchar2(4000) );

Click Run.

The message Table Altered appears.

Click the Home breadcrumb link at the top of the page.

To alter the process to insert documents into the oehr_file_subject table:

On the Workspace home page, click Application Builder.

Click Download App.

Click Page 1.

Under Processes, click the Insert file description link.

Scroll down to Source.

Under Source, replace the process with the following:

  IF ( :P1_FILE_NAME is not null ) THEN
     INSERT INTO oehr_file_subject(id,NAME, SUBJECT, BLOB_CONTENT, MIME_TYPE)
      SELECT ID,:P1_FILE_NAME,:P1_SUBJECT,blob_content,mime_type
            FROM APEX_APPLICATION_FILES
            WHERE name = :P1_FILE_NAME;
   DELETE from APEX_APPLICATION_FILES WHERE name = :P1_FILE_NAME;
  END IF;

Click Apply Changes.

Downloading Documents from the Custom Table

Now that documents are being stored in a custom table, you need to provide a way to download them. You do this by creating a procedure and granting execute on that procedure to the pseudo user APEX_PUBLIC_USER.

To accomplish this you need to change:

The SQL report region to no longer join to the APEX_APPLICATION_FILES view

The URL supplied for the ID column in the SQL report to execute the new procedure instead of executing the previous procedure

Topics in this section include:

Create a Procedure to Download Documents

Edit the Uploaded Files Region

Change the Download Link to Use the New Procedure

Create a Procedure to Download Documents

To create a procedure to download documents from the oehr_file_subject table and grant execute to public:

Go to SQL Commands:

Click the Home breadcrumb link at the top of the page.

The Workspace home page appears.

On the Workspace home page, click SQL Workshop and then SQL Commands.

The SQL Commands page appears.

Enter the following SQL statement:

CREATE OR REPLACE PROCEDURE download_my_file(p_file in number) AS
        v_mime  VARCHAR2(48);
        v_length  NUMBER;
        v_file_name VARCHAR2(2000);
        Lob_loc  BLOB;
BEGIN
        SELECT MIME_TYPE, BLOB_CONTENT, name,DBMS_LOB.GETLENGTH(blob_content)
                INTO v_mime,lob_loc,v_file_name,v_length
                FROM oehr_file_subject
                WHERE id = p_file;
              --
              -- set up HTTP header
              --
                    -- use an NVL around the mime type and
                    -- if it is a null set it to application/octect
                    -- application/octect may launch a download window from windows
                    owa_util.mime_header( nvl(v_mime,'application/octet'), FALSE );

                -- set the size so the browser knows how much to download
                htp.p('Content-length: ' || v_length);
                -- the filename will be used by the browser if the users does a save as
                htp.p('Content-Disposition:  attachment; filename="'||replace(replace(substr(v_file_name,instr(v_file_name,'/')+1),chr(10),null),chr(13),null)|| '"');
                -- close the headers
                owa_util.http_header_close;
                -- download the BLOB
                wpg_docload.download_file( Lob_loc );
end download_my_file;
/

Click Run.

The message Procedure Created appears.

Next, you want to run another SQL statement.

Click the SQL Workshop breadcrumb link and then click SQL Commands.

The SQL Commands page appears.

In the top section, replace the existing SQL statement with the following:

GRANT EXECUTE ON download_my_file TO PUBLIC/

Click Run.

The message Statement processed appears.

Click the Home breadcrumb link at the top of the page to return to the Workspace home page.

Edit the Uploaded Files Region

To change the SQL report region to no longer join with the APEX_APPLICATION_FILES view:

Go to the Page Definition of page 1:

On the Workspace home page, click Application Builder.

On the Application Builder home page, click Download App.

On the Application home page, click Page 1.

Under Regions, click Uploaded Files.

Scroll down to Source.

Replace the Region Source with the following:

SELECT s.id,s.name,s.subject FROM oehr_file_subject s

Click Apply Changes.

The Page Definition appears.

Change the Download Link to Use the New Procedure

Next you need to change the download link to call the PL/SQL download_my_file procedure.

Note:

If you are using Application Express in Database 11g, instead of calling the PL/SQL procedure as described in this section, please follow the steps outlined in the following section Create Download Page for Embedded PL/SQL Gateway.

To change the download link to use the new download procedure:

Under Regions, click Report next to Uploaded Files.

In the ID row, click the Edit icon.

Scroll down to the Column Link section.

In the URL field, replace the existing URL with the following:

#OWNER#.download_my_file?p_file=#ID#

In this URL:

#OWNER# is the parsing schema of the current application.

download_my_file is the new procedure you just created.

You are passing in the value of the column ID to the parameter p_file.

Click Apply Changes.

The Page Definition appears.

Create Download Page for Embedded PL/SQL Gateway

The Oracle XML DB HTTP Server with the embedded PL/SQL Gateway is typically used for Application Express in Oracle Database 11g. Calling a PL/SQL procedure directly from a URL that is not known in a list of allowed procedures, as shown in Change the Download Link to Use the New Procedure, results in an error message.

To avoid this situation, there are a couple of available options. The first option is to modify the PL/SQL function WWV_FLOW_EPG_INCLUDE_MOD_LOCAL to include the PL/SQL download_my_file procedure and then recompile. The second, described below, is to create a page in the application that has a before header branch to the PL/SQL download_my_file procedure. You then create a hidden item on that page for the document ID of the document to be downloaded.

To accomplish the second option you need to:

Create a page with a before header branch to the PL/SQL procedure download_my_file

Change the download link to use the new page to display the file

To create a page with a before header branch to the PL/SQL procedure download_my_file:

On the Application Home page, click Create Page.

Select Blank Page and click Next.

For Page Number, enter 2 and click Next.

For Name, enter Download File and click Next.

For Tabs, select No and click Next.

Click Finish.

The Success page appears.

Click Edit Page icon.

The Page Definition for page 2 appears.

Under Regions, click the Create icon.

For Region:

Identify the type of region to add to this page - Accept the default, HTML, and click Next.

Select the type of HTML region container you wish to create - Accept the default, HTML, and click Next.

For Display Attributes, specify the following:

For Title - Enter Display Document.

Accept the remaining default values.

Click Next.

Click Create Region.

The Page Definition for page 2 appears. A confirmation message displays at the top of the page: Region created.

Under Items on the Page Definition for page 2, click Create icon.

For Item Type, select Hidden and then click Next.

For Hidden Item Type, select Hidden and Protected and then click Next.

For Item Name, enter P2_DOC_ID and then click Next.

For Source, accept all defaults and then click Create Item.

The Page Definition for Page 2 appears.

Under Branches, click the Create icon.

For the Branch Point list, select On Load: Before Header.

For the Branch Type, select Branch to PL/SQL Procedure and then click Next.

For the Identify PL/SQL procedure to call text box, enter download_my_file(:P2_DOC_ID).

For Branch Conditions, accept defaults and click Create Branch.

The Page Definition for page 2 appears.

Change the download link to display to the Download Display page:

Click the Page 1 icon.

The Page Definition for page 1 appears.

Under Regions, click Report next to Uploaded Files.

The Report Attributes page appears.

Under Column Attributes, click the Edit icon in the ID row.

Scroll down to Column Link

Under Column Link:

Target - select Page in this Application

Page - enter 2

Item 1 Name - P2_DOC_ID

Item 1 Value - #ID#

Click Apply Changes.

Run the application.

Security Issues to Consider

The application you built in this tutorial provides download links that invoke the procedure download_my_file. Note that this approach has security implications that you need to be aware of.

To invoke your procedure, a user can click the links you provide, or a user can enter similar URLs in the Web browser's Address (or Location) field. Be aware that a curious or malicious user could experiment with your download_my_file procedure, passing in any file ID as the p_file argument. A hacker could determine what file IDs exist in your table by legitimate or illicit means. Worse yet, in a mechanized attack, a hacker could submit successive IDs until an ID matches a file in your table at which time your procedure would download the file to the hacker.

The measures you take to protect your data from unauthorized access depend upon:

Your assessment of the degree of harm that would result if a hacker were able to download a file.

The likelihood of such an attack balanced against the cost and difficulty of providing controls.

One technique you can use to protect an application is to call one of the Oracle Application Express security APIs from within the procedure in order to ensure that the user has already been authenticated. For example, you could include a block of code into the procedure so that it runs first. Consider the following example:

-- Assuming your application's numeric ID is 100, set g_flow_id to
--     that value, otherwise change the value as required.
--
APEX_APPLICATION.G_FLOW_ID := 100;

IF NOT wwv_flow_custom_auth_std.is_session_valid then
    --
    --
    -- display this message or a custom message.
    --
htp.p('Unauthorized access - file will not be retrieved.');
    --
    -- You can do whatever else you need to here to log the
    --     unauthorized access attempt, get the requestor's
    --     IP address, send email, etc.
    --
    RETURN;
END IF;

10 How to Incorporate JavaScript into an Application

Adding JavaScript to a Web application is a great way to add features that mimic those found in client/server applications without sacrificing all of the benefits of Web deployment. Oracle Application Express includes multiple built-in interfaces especially designed for adding JavaScript.

Remember that JavaScript is not appropriate for data intensive validations. For example, to verify that a name is contained within a large database table, you would need to pull down every record to the client, creating a huge HTML document. In general, complex operations are much better suited for server-side Oracle Application Express validations instead of JavaScript.

This tutorial describes some usage scenarios for JavaScript and includes details about how to implement them in your application.

This section contains the following topics:

Understanding How to Incorporate JavaScript Functions

About Referencing Items Using JavaScript

Calling JavaScript from a Button

Changing the Value of Form Elements

Creating a Client Side JavaScript Validation

Enabling and Disabling Form Elements

For additional examples on this topic, please visit the following Oracle by Examples (OBEs):

Incorporating JavaScript into Your Application

http://www.oracle.com/technology/obe/hol08/apexweb20/javascript_otn.htm

Using AJAX in your Application

http://www.oracle.com/technology/obe/hol08/apexweb20/ajax_otn.htm

Understanding How to Incorporate JavaScript Functions

There are two primary places to include JavaScript functions:

In the HTML Header attribute of a page

In a.js file referenced in the page template

Topics in this section include:

Incorporating JavaScript in the HTML Header Attribute

Including JavaScript in a .js File Referenced by the Page Template

Incorporating JavaScript in the HTML Header Attribute

One way to include JavaScript into your application is to add it to the HTML Header attribute of the page. This is a good approach for functions that are specific to a page as well as a convenient way to test a function before you include it in a.js file.

You can add JavaScript functions to a page by entering the code in the HTML Header attribute on the Page Attributes page.

To add JavaScript code in the HTML Header attribute:

On the Workspace home page, click the Application Builder icon.

Select an application.

The Application home page appears, displaying its set of pages.

Click a page.

The Page Definition for that page appears.

In the Page section, click the Edit page attributes icon.

The Edit Page appears.

Scroll down to the HTML Header section.

Enter code into HTML Header and then click Apply Changes.

For example, adding the following code would test a function accessible from anywhere on the current page.

<script type="text/javascript">
  function test(){
    window.alert('This is a test.');
  }
</script>

Including JavaScript in a .js File Referenced by the Page Template

In Oracle Application Express you can reference a.js file in the page template. This approach makes all the JavaScript in that file accessible to the application. This is the most efficient approach because a.js file loads on the first page view of your application, and is then cached by the browser.

The following code demonstrates how to include a .js file in the header section of a page template. Note the line script src= that appears in bold.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>#TITLE#</title>
    #HEAD#
    <script src="http://myserver.myport/my_images/custom.js" type="text/javascript"></script>
</head>
<body #ONLOAD#>#FORM_OPEN#

See Also:

"Customizing Templates" in Oracle Database Application Express User's Guide

About Referencing Items Using JavaScript

When you reference an item, the best approach is to reference the item name as it is defined within the page. Note that item name is different than the item label. The item name displays on the Page Definition and the label displays on a running page. For example, if you create an item with the name P1_FIRST_NAME and a label of First Name, you would reference the item using P1_FIRST_NAME.

Referencing an item by the item name enables you to use the JavaScript method getElementById() to get and set item attributes and values. The following example demonstrates how to reference an item by ID and display its value in an alert box.

<script type="text/javascript">
  function firstName(){
    window.alert('First Name is ' + document.getElementById('P1_FIRST_NAME').value );
  }
 // or a more generic version would be
  function displayValue(id){
    alert('The Value is ' + document.getElementById(id).value );
  }
</script>

  // Then add the following to the "Form Element Attributes" Attribute of the item:
  onchange="displayValue('P1_FIRST_NAME');"

Calling JavaScript from a Button

Calling a JavaScript from a button is a great way to confirm a request. Oracle Application Express uses this technique for the delete operation of most objects. For example, when you delete a button, a JavaScript message appears asking you to confirm your request. Consider the following example:

<script type="text/javascript">
  function deleteConfirm(msg)
  {
var confDel = msg;
if(confDel ==null)
  confDel= confirm("Would you like to perform this delete action?");
else
  confDel= confirm(msg);

if (confDel== true)
  doSubmit('Delete');
  }
</script>

This example creates a function to confirm a delete action and then calls that function from a button. Note that the function optionally submits the page and sets the value of the internal variable :REQUEST to Delete, thus performing the delete using a process that conditionally executes based on the value of request.

Note that when you create the button, you need to select Action Redirect to URL without submitting page. Then, you specify a URL target, such as the following:

confirmDelete('Would you like to perform this delete action?');

Changing the Value of Form Elements

In the following example, there are four text boxes in a region. The fourth text box contains the sum of the other three. To calculate this sum, you add a JavaScript function to the HTML Header attribute and then call that function from the first three items.

To add a function to the HTML Header attribute:

Go to the appropriate Page Definition.

In the Page section, click the Edit page attributes icon.

The Edit Page appears.

In the HTML Header section, enter the following:

<script type="text/javascript">
  function sumItems(){
    function getVal(item){
   if(document.getElementById(item).value != "")
     return parseFloat(document.getElementById(item).value);
   else
     return 0;
    }
    document.getElementById('P1_TOTAL').value =
  getVal('P1_ONE') + getVal('P1_TWO') + getVal('P1_THREE');
  }
</script>

Click Apply Changes.

To call the function from all three items:

Go to the appropriate Page Definition.

For each item:

Select the item name by clicking it.

Scroll down to Element.

In HTML Form Element Attributes, enter:

onchange="sumItems();"

Click Apply Changes.

Creating a Client Side JavaScript Validation

Client side validations give immediate feedback to users using a form. One very common JavaScript validation is field not null. This type of validation works well in the page header rather than in a.js because it is so specific to a page.

Before you begin, you need to import and install the OEHR Sample Objects application in order to access the necessary sample database objects. See "About Loading Sample Objects".

Topics in this section include:

Create an Application on the OEHR_EMPLOYEES Table

Add a Function to the HTML Header Attribute

Edit an Item to Call the Function

Test the Validation by Running the Page

Create an Application on the OEHR_EMPLOYEES Table

To create a new application on the OEHR_EMPLOYEES table:

On the Workspace home page, click Application Builder.

Click Create.

For Method, select Create Application and then click Next.

For Name, specify the following:

Name - Enter JavaScript Example.

Application - Accept the default.

Create Application - Select From scratch.

Schema - Select the schema where you installed the OEHR sample objects.

Click Next.

Add a page containing a report by specifying the following in the Add Page section:

Select Page Type - Select Report and Form.

Table Name - Select OEHR_EMPLOYEES.

Click Add Page.

The new pages appear in the list at the top of the page. Next, change the name of page 2 to Update Form.

To change the name of page 2:

Under Create Application at the top of the page, click the page name OEHR_EMPLOYEES for page 2 as shown in Figure 10-1.

Figure 10-1 Newly Created Pages

Description of Figure 10-1 follows
Description of "Figure 10-1 Newly Created Pages"

The Page Definition appears.

In Page Name, enter Update Form.

Click Apply Changes

Click Next.

For Tabs, accept the default, One Level of Tabs and then click Next.

For Shared Components, accept the default, No, and click Next.

For Attributes, accept the defaults for Authentication Scheme, Language, and User Language Preference Derived From and click Next.

For User Interface, select Theme 2 and click Next.

Click Create.

The Application home page appears. Note the new application contains three pages:

1 - OEHR_EMPLOYEES

2 - Update Form

101 - Login

To view the application:

Click the Run Application icon as shown in Figure 10-2.

Figure 10-2 Run Application Icon

Description of Figure 10-2 follows
Description of "Figure 10-2 Run Application Icon"

When prompted for a user name and password, enter your workspace user name and password and click Login. See "About Application Authentication".

A standard report appears. To view the update form, click either the Create button or Edit icon.

Click Application on the Developer toolbar to return to the Application home page.

Add a Function to the HTML Header Attribute

Next, you need to add a function to the HTML Header attribute on page 2 that displays a message when the Last Name field does not contain a value.

To add a function to the HTML Header attribute on page 2:

On the Application home page, click 2 - Update Form.

The Page Definition for page 2 appears.

Under Page, click the Edit page attributes icon as shown in Figure 10-3.

Figure 10-3 Edit Page Attributes Icon

Description of Figure 10-3 follows
Description of "Figure 10-3 Edit Page Attributes Icon"

The Edit Page appears.

Scroll down to HTML Header.

Note that HTML Header already contains a script. When the user clicks the Delete button, this script displays the following message.

Would you like to perform this delete action?

In HTML Header, scroll down and place your cursor after the last </script> tag.

After the last </script> tag, enter the following script:

<script type="text/javascript">
  function notNull(object){
    if(object.value=="")
   alert('This field must contain a value.');
  }
</script>

At the top of the page, click Apply Changes.

The Page Definition for page 2 - Update Form appears.

Edit an Item to Call the Function

Next, you need to edit the P2_LAST_NAME item to call the function.

To edit the P2_LAST_NAME item to call the function:

Under Items, click P2_LAST_NAME.

Scroll down to Element.

In HTML Form Element Attributes, enter the following:

onblur="notNull(this);"

At the top of the page, click Apply Changes.

The Page Definition appears. Next, run the page.

Test the Validation by Running the Page

Next, navigate to page 1 and run the page.

To test the validation:

Enter 1 in the Page field on the Page Definition and click Go.

The Page Definition for page 1 appears.

Click the Run Page icon in the upper right corner.

When the application appears, click Create.

The Update Form appears.

Position your cursor in the Last Name field and then click Create. The message This field must contain a value appears as shown in Figure 10-4.

Figure 10-4 Update Form

Description of Figure 10-4 follows
Description of "Figure 10-4 Update Form"

Enabling and Disabling Form Elements

While Oracle Application Express enables you to conditionally display a page item, it is important to note that a page must be submitted for any changes on the page to be evaluated. The following example demonstrates how to use JavaScript to disable a form element based on the value of another form element.

First, you write a function and place it in the HTML Header attribute of the page containing your update form. Second, you call the function from an item on the page. The following example demonstrates how to add a JavaScript function to prevent users from adding commissions to employees who are not in the Sales Department (P2_DEPARTMENT_ID = 80).

Topics in this section include:

Add a Function to the HTML Header Attribute

Edit an Item to Call the Function

Change the Item to a Select List

Create a Call to the disFormItems Function

Add a Function to the HTML Header Attribute

To add a function to the HTML Header attribute on page 2:

Go to the Page Definition for page 2.

Under Page, click the Edit page attributes icon.

The Edit Page appears.

Scroll down to HTML Header.

In HTML Header, scroll down and place your cursor after the last </script> tag.

After the last </script> tag, enter the following script:

<script language="JavaScript1.1" type="text/javascript">
function html_disableItem(nd,a){
     var lEl = document.getElementById(nd);
     if (lEl && lEl != false){
       if(a){
         lEl.disabled = false;
          lEl.style.background = '#ffffff';
        }else{
        lEl.disabled = true;
          lEl.style.background = '#cccccc';
         }}
     return true;}

 function disFormItems(){
  var lOptions = document.getElementById('P2_DEPARTMENT_ID').options
  var lReturn;
  for(var i=0;i<lOptions.length;i++){
     if(lOptions[i].selected==true){lReturn = lOptions[i].value;}
  }
  var lTest = lReturn == '80';
  html_disableItem('P2_COMMISSION_PCT',lTest); }

 </script>

Click Apply Changes.

Edit an Item to Call the Function

The next step is to edit the P2_DEPARTMENT_ID item and add code to the HTML Form Element Attributes attribute to call the function.

To edit the P2_DEPARTMENT_ID item to call the function:

Under Items, select P2_DEPARTMENT_ID.

Scroll down to Element.

In HTML Form Element Attributes, enter the following:

onchange="disFormItems()"

Click Apply Changes.

Change the Item to a Select List

To change the P2_DEPARTMENT_ID to display as a select list:

Under Items, select P2_DEPARTMENT_ID.

From the Display As list in the Name section, select Select List.

Scroll down to List of Values.

Under List of Values, specify the following:

From Display Null, select No.

In List of Values definition, enter:

SELECT department_name, department_id FROM oehr_departments

Click Apply Changes.

Tip:

For simplicity, this tutorial has you create an item-level list of values. As a best practice, however, consider creating a named LOV and referencing it.

See Also:

"Creating Lists of Values" in Oracle Database Application Express User's Guide

Create a Call to the disFormItems Function

Finally, you need to create a call to the disFormItems function after the page is rendered to disable P2_COMMISSION_PCT if the selected employee is not a Sales representative. A good place to make this call would be from the Page HTML Body Attribute.

To create a call to the disFormItems function:

Go to the Page Definition for page 2.

Under Page, click the Edit page attributes icon.

The Edit Page appears.

Locate the Display Attributes section.

From Cursor Focus, select Do not focus cursor.

Selecting Do not focus cursor prevents conflicts between generated JavaScript and custom JavaScript.

Scroll down to the HTML Body Attribute section.

In the Page HTML Body Attribute, enter the following:

onload="disFormItems(); first_field();"

Click Apply Changes.

Run the page.

Figure 10-5 demonstrates the completed form. Note that Department ID displays as a select list. Also notice that the Commission Pct field is unavailable since the Department ID is Administration.

Figure 10-5 Revised Update Form

Description of Figure 10-5 follows
Description of "Figure 10-5 Revised Update Form"

11 How to Build an Access Control Page

You can control access to an application, individual pages, or page components by creating an Access Control Administration page. The page contains a list of application modes and an Access Control List.

This tutorial explains how to build an Access Control Administration page and then restrict access to an application so that only privileged users can perform specific functions.

This section contains the following topics:

How Access Control Administration Works

Creating an Application

Creating an Access Control Administration Page

Creating an Authentication Function

Updating the Current Authentication Scheme

Applying Authorization Schemes to Components

Testing the Application

For additional examples on this topic, please visit the following Oracle by Examples (OBEs):

Adding Security to your Application

http://www.oracle.com/technology/obe/hol08/apexintro/apex3.1.1_d/apex3.1.1_d_otn.htm

How Access Control Administration Works

You create an access control list by running the Access Control Wizard to create an Access Control Administration page. This page contains a list of application modes and an Access Control List. Once you create the Access Control Administration page, you:

Run the Access Control Administration page.

Select an application mode:

Full access to all, access control list not used.

Restricted access. Only users defined in the access control list are allowed.

Public read only. Edit and administrative privileges controlled by access control list.

Administrative access only.

Add users to the Access Control List.

In addition to creating the Access Control Administration page, the Access Control Wizard also creates:

two tables within the application's default schema to manage access control

the authorization schemes that correspond to the application mode list options

the privileges available in the Access Control List

You can control access to a specific page or page component by selecting one of these authorization schemes on the page or component attributes pages. Once you create an Access Control, you can customize the page, tables and values to suit the specific needs of your application.

Creating an Application

First, you need to create an application based on employee data in a spreadsheet.

Topics in this section include:

Download Spreadsheet Data

Create an Application Based on Spreadsheet Data

Run the Application

Download Spreadsheet Data

Download the following *.csv file to you local machine:

In your Web browser go to:

http://www.oracle.com/technology/products/database/application_express/packaged_apps/acl_employees.zip

Download the acl_employees.zip file to your computer.

Unzip and extract the acl_employees.csv file:

Microsoft Windows - Double-click the acl_employees.zip file

UNIX or Linux - Enter the following command:

$ unzip acl_employees.zip

Create an Application Based on Spreadsheet Data

To create a new application based on spreadsheet data:

On the Workspace home page, click the Application Builder icon.

The Application Builder home page appears.

Click Create.

Select Create from Spreadsheet and click Next.

Select Upload file, comma separated (*.csv) or tab delimited and click Next.

For Load Method:

Select Upload file, comma separated (*.csv) or tab delimited.

Click Next.

For Data:

Text File - Click Browse and navigate to the acl_employees.csv file.

Accept the remaining defaults and click Next.

For Table Properties:

Schema - Select the appropriate schema.

Table Name - Enter ACL_EMPLOYEES.

Accept the remaining defaults and click Next.

For User Interface Defaults:

Singular Name - Enter Employee.

Plural Names - Enter Employees.

Click Next.

For Summary Page:

Summary by Column - Select DEPARTMENT_ID and click Next.

Aggregate by Column - Do not make a selection and click Next.

For Application Options, accept the defaults and click Next.

For User Interface, select Theme 2 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.

Click Create.

The Application home page appears.

Run the Application

To run the application:

Click the Run Application icon as shown in Figure 11-1.

Figure 11-1 Run Application Icon

Description of Figure 11-1 follows
Description of "Figure 11-1 Run Application Icon"

If prompted to enter a user name and password, enter your workspace user name and password and click Login. See "About Application Authentication".

The report appears as shown in Figure 11-2.

Figure 11-2 ACL_EMPLOYEES Application

Description of Figure 11-2 follows
Description of "Figure 11-2 ACL_EMPLOYEES Application"

The ACL_EMPLOYEES application enables you to view and update employee data. To update a specific record, click the Edit icon in the far left column. Clicking the Analyze tab provides you with access to both a visual and tabular breakdown of the number of employees in each department.

Creating an Access Control Administration Page

Next, you need to secure your application so that only privileged users can perform certain operations. When you implement access control on an Oracle Application Express application, the best approach is to use an authorization scheme defined at the application level. The first step is to create an access control page by running the Access Control Page Wizard.

Topics in this section include:

Create an Access Control Page

View the Page

Add Users to the Access Control List

Create an Access Control Page

To create an access control page:

Click Create on the Developer toolbar.

Select New page and click Next.

For Page, select Access Control and click Next.

The Access Control Wizard appears.

In Administration Page Number, enter 8 and click Next.

For Tabs:

Tab Options - Select Use an existing tab set and create a new tab within the existing tab set.

Tab Set - Select TS1 (Employees, Analyze).

Tab Set Label - Enter Administration.

Click Next.

Review the confirmation page and click Finish.

A Success page appears.

View the Page

To run the page:

Click Run Page.

A new page appears as shown in Figure 11-3.

Figure 11-3 Access Control Administration Page

Description of Figure 11-3 follows
Description of "Figure 11-3 Access Control Administration Page"

Notice the page is divided into two regions: Application Administration and Access Control List. Also note that the default Application Mode is Full Access.

Under Application Mode, select Restricted access. Only users defined in the access control list are allowed.

Click Set Application Mode.

Add Users to the Access Control List

Next, add three users to the Access Control List:

Luis Popp (LPOPP) will have View privileges.

Adam Fripp (AFRIPP) will have Edit privileges.

John Chen (JCHEN) will have Administrator privileges.

To add users to the Access Control List:

Under Access Control List, click Add User.

A new row appears.

Enter the first user:

Username - Enter LPOPP.

Privilege - Select View.

Click Apply Changes.

Click Add User to add a blank row where you can enter the first user.

Enter the next user:

Username - Enter AFRIPP.

Privilege - Select Edit.

Click Apply Changes.

Click Add User to add a blank row where you can enter the next user.

Enter the next user:

Username - Enter JCHEN.

Privilege - Select Administrator.

Click Apply Changes.

Click Application on the Developer toolbar.

The Application home page appears.

Creating an Authentication Function

Next, you need to make employees in the ACL_EMPLOYEES table the users of the application. To accomplish this, you create a simple authentication function in the current authentication scheme. Note that the function checks for the userid and its associated last name as a password.

To create the authentication function:

On the Application Builder home page, click the Home breadcrumb link.

The the Workspace home page appears.

Click SQL Workshop and then SQL Commands.

In the SQL editor pane:

Enter the following code:

CREATE OR REPLACE FUNCTION acl_custom_auth (
    p_username IN VARCHAR2,
    p_password IN VARCHAR2)
RETURN BOOLEAN IS
BEGIN
  FOR c1 IN (SELECT 1
              FROM acl_employees
             WHERE upper(userid) = upper(p_username)
               AND upper(last_name) = upper(p_password))
  LOOP
    RETURN TRUE;
  END LOOP;
  RETURN FALSE;
END;
/

Click Run.

Click the Home breadcrumb link.

The Workspace home page appears.

Updating the Current Authentication Scheme

Next, you need to update the current authentication scheme to use the new function.

To update the current authentication scheme.

Click Application Builder and then click ACL Employees.

The Application home page appears.

Click Shared Components.

Under Security, click Authentication Schemes.

The Authentication Schemes page appears.

Click the Application Express - Current icon.

Scroll down to Login Processing.

In Authentication Function, replace -BUILTIN- with the following:

return acl_custom_auth

Scroll back to the top of the page and click Apply Changes.

Applying Authorization Schemes to Components

Next you need to associate the authorization scheme with the appropriate application components. As you may recall, you previously added three users to the Access Control List:

LPOPP had View privileges.

AFRIPP had Edit privileges

JCHEN had Administrator privileges

In this exercise, you associate the View, Edit, and Administrator privileges with specific application components to control which users are allowed to perform what actions.

Topics in this section include:

Associate an Authorization Scheme with the Application

Associate Edit Privileges with the ID Column

Associate Edit Privileges with the Create Button

Associate Edit Privileges with Page 2

Restrict Access to Page 8

Associate an Authorization Scheme with the Application

First, you need to specify that users will only be able to access the application if they have View privileges. To accomplish this, you associate the access control - view authorization scheme with the application.

To associate an authorization scheme with your application:

Click the Application ID breadcrumb link.

The Application home page appears.

Click Shared Components.

Under Application, click Definition.

Click the Security tab.

Scroll down to Authorization.

From Authorization Scheme, select access control - view.

Click Apply Changes at the top of the page.

Associate Edit Privileges with the ID Column

For this exercise, only users with at least Edit privileges should be able to edit or delete data. To accomplish this, you associate the access control - edit authorization scheme with the ID column. This hides the Edit icon on page 1 for users with View privileges, but displays it for users with Edit or Administrator privileges.

To associate edit privileges with the ID column:

Click the Application ID breadcrumb link.

The Application home page appears.

Click 1 - Report Page.

The Page Definition for page 1 appears.

Under Regions, click the Report link.

The Report Attributes page appears.

Click the Edit icon for ID. The Edit icon resembles a small page with a pencil on top of it.

The Column Attributes page appears.

Scroll down to Authorization.

From Authorization Scheme, select access control - edit.

Click Apply Changes at the top of the page.

Associate Edit Privileges with the Create Button

Next, associate the access control - edit authorization scheme to the Create button. This will hide the Edit icon for unprivileged users.

To associate edit privileges with the Create button:

Go to the Page Definition for Page 1. Click the Page 1 breadcrumb link.

The Page Definition for page 1 appears.

Under Buttons, click the Create link (not the icon).

Scroll down to Authorization.

From Authorization Scheme, select access control - edit.

Click Apply Changes at the top of the page.

The Page Definition for Page 1 appears.

Associate Edit Privileges with Page 2

Next, associate the access control - edit authorization scheme with page 2.

To specify an authorization scheme for page 2:

Go to page 2. In the Page field enter 2 and click Go.

The Page Definition for page 2 appears.

Under Page, click the Edit page attributes icon.

Scroll down to Security.

From Authorization Scheme, select access control - edit.

Click Apply Changes at the top of the page.

Restrict Access to Page 8

Lastly, you need to restrict access to page 8, Access Control Administration. To accomplish this, you specify the access control - administrator authorization scheme with all of page 8 and with the Administration tab.

Specify an Authorization Scheme for Page 8

To specify an authorization scheme for page 8:

Go to page 8. In the Page field, enter 8 and click Go.

The Page Definition for page 8 appears.

Under Page, click the Edit page attributes icon.

Scroll down to Security.

From Authorization Scheme, select access control - administrator.

Click Apply Changes at the top of the page.

The Page Definition for page 8 appears.

Specify an Authorization Scheme for the Administration Tab

To specify an authorization scheme for page 8:

Under Tabs, click the Administration link.

Scroll down to Authorization.

From Authorization Scheme, select access control - administrator.

Click Apply Changes at the top of the page.

The Page Definition for page 8 appears.

Testing the Application

At the beginning of this tutorial, you added three users to the Access Control List:

Luis Popp (LPOPP) has View privileges

Adam Fripp (AFRIPP) has Edit privileges

John Chen (JCHEN) has Administrator privileges

Next, test your application by logging in as each of these users.

Topics in this section include:

Log In with View Privileges

Log In with Edit Privileges

Log In with Administrator Privileges

Log In with View Privileges

Luis Popp (LPOPP) has View privileges.

To log in as Luis Popp:

Click the Run Page icon in the upper right corner.

When prompted, specify the following:

Username - LPOPP.

Password - Popp.

Click Login.

The Employees Report page appears as shown in Figure 11-4.

Figure 11-4 Employees Report with View Privileges

Description of Figure 11-4 follows
Description of "Figure 11-4 Employees Report with View Privileges"

Note that the Edit icon and the Administration tab no longer appear.

Click Logout in the upper right corner.

Log In with Edit Privileges

Adam Fripp (AFRIPP) has Edit privileges.

To log in as Adam Fripp:

When prompted, specify the following:

Username - AFRIPP.

Password - Fripp.

Click Login.

The Employees Report page appears as shown in Figure 11-5.

Figure 11-5 Employees Report with Edit Privileges

Description of Figure 11-5 follows
Description of "Figure 11-5 Employees Report with Edit Privileges"

Note that the Edit icon now appears to the left of the Employee Id column, but the Administration tab still does not appear.

Click Logout in the upper right corner.

Log In with Administrator Privileges

John Chen (JCHEN) has Administrator privileges.

To log in as John Chen:

When prompted, specify the following:

Username - JCHEN

Password - Chen

Click Login.

The Employees Report page appears as shown in Figure 11-6.

Figure 11-6 Employees Report with Administrator Privileges

Description of Figure 11-6 follows
Description of "Figure 11-6 Employees Report with Administrator Privileges"

Click Administrator tab.

12 How to Review a Packaged Application

A packaged application is a fully functional application that you can view, use, and customize. Each packaged application includes installation scripts that define the application's supporting objects (including database objects, images, and seed data) as well as any preinstallation validations. Packaged applications can also include a de-installation script which can be used to remove all the application's supporting objects.

This tutorial walks you through the OEHR Sample Objects packaged application. By reviewing the supporting objects behind this application, you can learn how to define them in your own applications.

Before you begin, you need to import and install the OEHR Sample Objects application. See "About Loading Sample Objects".

This section contains the following topics:

What Is a Packaged Application?

About the Supporting Object Utility

About Supporting Objects Installation

About Supporting Objects Deinstallation

About Supporting Objects Export

About Creating Upgrade Scripts

About Refining Your Installation Scripts

Downloading Public Packaged Applications and Sample Code

What Is a Packaged Application?

Importing and installing an application is a complicated process. First, you create the target database objects and seed data. Second, you import and install the application definition and all related files, including images, themes, and any other required static files.

Creating a packaged application simplifies this process. Instead of performing numerous steps to create the database objects and then import and install the application and all supporting files, you can define the supporting objects so that the application and supporting files can be installed using one simple wizard.

After users import and install the application definition, a wizard guides them through a few simple configuration steps. Then, the wizard asks whether or not to install the supporting application objects. Users have the option of installing the supporting application objects then or doing it later.

See Also:

"How to Create a Packaged Application" in Oracle Database Application Express User's Guide.

About the Supporting Object Utility

In "About Loading Sample Objects", you imported and installed the OEHR Sample Objects application. Installing this application creates the database objects and loads the sample data needed to complete the tutorials in this guide.

You create a packaged application like OEHR Sample Objects using the Supporting Object Utility. By creating a packaged application, users can install and deinstall your application as well as the underlying database objects, files, and other supporting objects. Supporting objects consists of everything that your application needs to work properly, including the application definition, images, themes, and any other required static files.

Creating a packaged application is also an effective way to move an application to another Oracle Application Express instance or to share an application with others. The Supporting Object Utility provides the easiest way to ensure that all objects your application depends on are migrated in an efficient manner.

Accessing the Supporting Objects Page

You access the Supporting Object Utility on the Supporting Objects page.

To go to the Supporting Objects page:

On the Workspace home page, click Application Builder.

Click OEHR Sample Objects.

On the Application home page, click Supporting Objects.

The Supporting Objects page appears.

Description of pck_supobj.gif follows
Description of the illustration pck_supobj.gif

The top of the Supporting Objects page displays a detailed report about the currently selected application, including the number of scripts and the amount of required free space. After that, the page is divided into these sections:

Installation

Upgrade

Deinstallation

Messages

About Supporting Objects Installation

During the installation of supporting objects, a sequence of scripts and validations are run. If a validation fails, the installation process stops. At certain points in the process, messages also display for users to review.

Description of pck_instl_mes.gif follows
Description of the illustration pck_instl_mes.gif

This section describes the Installation and Messages sections of the Supporting Objects page. Depending upon the needs of your application, you may use all or only some of the functionality.

In order to give context, this section describes the supporting objects in the sequence that they would appear to a user who is performing the installation.

Topics in this section include:

Welcome Message

Prerequisites

License Acceptance

Application Substitution Strings

Build Options

Pre-Installation Validations

Pre-Installation Confirmation Message

Installation Scripts

Success Message

Welcome Message

The welcome message contains text that displays to users immediately after they indicate that they want to install the supporting objects. Use this message to introduce the application to users and to explain any information that they may need during the rest of the installation process.

To review the welcome message text:

Go to Supporting Objects page as described in "Accessing the Supporting Objects Page".

In the Messages section, click Welcome message.

The Supporting Object Messages page appears. The Welcome message appears in the first section.

Prerequisites

Prerequisites include anything that must be valid for the installation process to continue.

To review the prerequisites:

On the Supporting Object Messages page, click the Prerequisites tab.

The Prerequisites page displays the following sections:

Required Free Space in KB

Required System Privileges

Objects that will be Installed

Description of pck_prerq.gif follows
Description of the illustration pck_prerq.gif

About Required Free Space

If you are creating tables and loading data during the installation, you should specify the amount of required free space. If there is not enough free space available, specifying this prerequisite prevents an error during the installation of supporting objects. For the OEHR Sample Objects application, the required free space is 4800 kilobytes (KB).

To determine the space that your objects require:

Remove your supporting objects by either manually deleting them, or running your deinstallation script.

Go to the Supporting Objects page as described in "Accessing the Supporting Objects Page".

From the Tasks list on the right side of the page, click Deinstall Supporting Objects.

On the Deinstall page, select Deinstall Supporting Objects and click Deinstall.

View that amount of used space:

Go to the Workspace home page.

From the Administration list on the right, click Manage Services.

Under Workspace section, click Workspace Overview.

Click the Detailed Tablespace Utilization Report (may take several seconds) link.

The Detailed Tablespace Utilization Report appears.

Write down the number that appears in the Amount Used column.

This shows the amount of used space in the tablespace where your schema is located.

Install your supporting objects by either manually creating them again, or running your installation scripts.

Go to the Supporting Objects page as described in "Accessing the Supporting Objects Page".

From the Tasks list on the right side of the page, click Install Supporting Objects.

For Install Supporting Objects, select Yes and click Next.

Click Install.

View that amount of used space again:

Go to the Workspace home page.

From the Administration list on the right, click Manage Services.

Under Workspace section, click Workspace Overview.

Click the Detailed Tablespace Utilization Report (may take several seconds) link.

The Detailed Tablespace Utilization Report appears.

Write down the number that appears in the Amount Used column.

Subtract the initial Amount of Used number from the new number to determine your required free space.

Tip:

The value in the Amount Used column is in megabytes (MB). To calculate the amount in kilobytes (KB), multiply the final figure by 1,024 (1 MB = 1,024 KB).

About Required System Privileges

The Required System Privileges section contains a list of system privileges. If you are creating objects through installation scripts, you need to select the appropriate system privileges. Selecting these privileges runs a pre-installation check to determine if the user has the appropriate privileges. This prevents the user from creating some objects but not others due to a lack of privileges.

For the OEHR Sample Objects application, required system privileges include: CREATE SEQUENCE, CREATE TRIGGER, CREATE TYPE, CREATE PROCEDURE, CREATE TABLE, and CREATE VIEW.

About Objects Installed

The Objects that will be Installed section lists all objects that your installation script creates. If the target schema contains an object with the same name, an error displays to the user. This prerequisite prevents the user from getting errors during installation that result in some objects being created while others are not created because an object of the same name exists.

This prerequisite is important because of the deinstallation implications. If a user installs and already has an object with the same name, the deinstallation script might drop the previously existing object.

For example, if a PROJECTS table already exists and the installation script creates a table with the same name, you would want to alert users before they start the installation process. This warning provides them with the opportunity to rename their table or decide to not install supporting objects.

License Acceptance

If your application requires that users accept a specific license, specify the terms in this area. For a required license, users are prompted to accept the terms. If they do not, the installation does not proceed.

To review the license area:

On the Supporting Object Messages page, click the Messages tab.

Locate the section, License.

Since the OEHR Sample Objects application does not require a license, no text appears in the License section.

Application Substitution Strings

Each application can include substitution strings defined within the Application Definition. You can use substitution strings to include phrases or labels occurring in many places within an application that might need to be changed for specific installations.

When you define substitution strings for your application, they display within the Supporting Object Utility. You can then decide which substitution strings you want to display during the installation process.

For substitution strings that display during the installation process, you can provide a custom prompt to explain what each string is used for to assist the user in determining the proper value. You can also define a custom header message if you are including substitution strings.

Since the OEHR Sample Objects application does not contain any substitution strings, in the next section you add two substitution strings and then view them the Supporting Object Utility.

Add Substitution Stings

To add substitution strings to the OEHR Sample Objects application:

Go to the Shared Components page:

Click the Application breadcrumb.

Click Shared Components.

Under Application, click Definition.

Scroll down to the Substitutions region.

Enter the following Substitution Strings and Substitution Values:

Substitution String | Substitution Value
APP_DATE_FORMAT | DD-MON-YYYY
APP_DATETIME_FORMAT | DD-MON-YYYY HH24:MI

Scroll back to the top and click Apply Changes.

Review Substitution Strings

To view the substitution strings in Supporting Object Utility:

Go to the Supporting Objects page:

Click the Application breadcrumb.

Click Supporting Objects.

In the Installation section, click Application Substitution strings.

The Edit Substitutions page appears, showing the two substitution strings that you defined. If have a prompt appear during installation, select it and enter text in the Prompt Text field.

Description of pck_subst.gif follows
Description of the illustration pck_subst.gif

Build Options

Build options are shared components that enable you to conditionally display objects. Each build option has a status set to Include or Exclude. If an object is associated with a disabled build option, the object does not appear to the user.

Use build options to include functionality in an application that may not be ready for use, or should not be accessible to all installations. The code is included in the application but not exposed to end users. Later, you can enable a build option so that the feature becomes accessible. For each build option, you can define a custom header message to display to the user.

Build options display in the same way as the substitution strings. You specify which build options you want to appear to users. The users can then select them and determine their status.

The OEHR Sample Objects application does not contain any build options.

See Also:

"Using Build Options to Control Configuration" in Oracle Database Application Express User's Guide

Review the Build Options Page

To review the Build Options page:

On the Edit Substitutions page, click the Build Options tab.

To view the Build Options message:

Click the Messages tab.

Scroll down to the Build Options section.

Pre-Installation Validations

Validations ensure that the target database and target schema are capable of running the installation scripts. Built-in validation types include Current Language, Exists, and so on. You can also use any SQL or PL/SQL expressions. Validations can also be conditionally executed.

Use these validations to check for anything that is not built-in under Prerequisites. For example, you can check for a minimum database version or for the installation of Oracle Text. Just as with other supporting objects, there is a Validations Message.

The OEHR Sample Objects application does not contain any validations.

See Also:

"Understanding Validations" in Oracle Database Application Express User's Guide

Review the Validation Page

To review the Validations page:

Click the Validations tab.

Click Create.

The Validation page appears.

Description of pck_prinstval.gif follows
Description of the illustration pck_prinstval.gif

For this exercise, click Cancel.

To view the Validations Message:

Click the Messages tab.

Scroll down to the Validations section.

Pre-Installation Confirmation Message

If the installation process is not terminated early, one last confirmation message appears before the installation scripts display to the user.

To review the confirmation message:

Click the Messages tab.

On the Supporting Object Messages page, scroll down to the Confirmation section.

Installation Scripts

Installation scripts are the core of a supporting object installation. Each application can have several installation scripts.

The OEHR Sample Objects application contains nine installation scripts. These scripts create objects and load data.

Tip:

You can also create a custom installation script that loads files. See "About Creating Scripts to Install Files".

Topics in this section include:

View Installation Scripts

Review an Existing Installation Script

About Creating Installation Scripts from Files

About Creating Scripts to Install Files

View Installation Scripts

To review the installation scripts in the OEHR Sample Objects application:

On the Supporting Object Messages page, click the Install tab.

The Installation Scripts page shows the list of scripts.

Description of pck_instscrpts.gif follows
Description of the illustration pck_instscrpts.gif

Notice that each script has a name and a sequence. It is very important to order your installation scripts so that dependent objects are created or compiled correctly.

Review an Existing Installation Script

To review or update an existing script:

Click the Edit icon adjacent to the script name.

The Script Editor page displays the script for you to edit or review.

Figure 12-1 Supporting Object Script Editor

Description of Figure 12-1 follows
Description of "Figure 12-1 Supporting Object Script Editor"

Tip:

You can toggle between this page and a text page, where you can also edit the script, by clicking the Edit Using Text Area button.

To view and edit the properties of the script, click the Script Properties tab.

Use the Script Properties page to change the script name or sequence. You can also specify if it should be conditionally executed.

Description of pck_scrprop.gif follows
Description of the illustration pck_scrprop.gif

For this exercise, click Cancel.

About Creating Installation Scripts from Files

You can create objects and install seed date through files that you create from scratch or upload.

Topics in this section include:

Creating a New Script from Scratch

Uploading a File

Creating Scripts for Access Control Tables

Creating a New Script from Scratch

To create a new script from scratch:

Go to the Installation Scripts page:

Click the Supporting Objects breadcrumb.

Under Installation, click Installation scripts

On the Installation Scripts page, click Create.

Accept the default, Create from Scratch, and click Next.

The Create Script wizard appears.

For Script Attributes:

Name - Enter Test Script.

Sequence - Accept the default, 100.

Use Editor - Select this option.

Selecting Use Editor enables you to use the built-in editor to define your script. If you do not select this, a standard text area appears instead.

Click Next.

The Script Editor opens, where you can type in or paste your script contents.

For this exercise, click Cancel.

Uploading a File

Often, you have files that you want to use as the basis of your installation scripts.

To upload a file:

On the Installation Scripts page, click Create.

Select Create from file and click Next.

For Script Attributes:

Name - Enter Test Script.

Sequence - Accept the default, 100.

Click Next.

For Define Script, select the file to upload.

For this exercise, click Cancel.

Creating Scripts for Access Control Tables

If your application includes an access control list, you can create scripts to create the underlying access control tables.

See Also:

"Controlling Access to Applications, Pages, and Page Components" in Oracle Database Application Express User's Guide

To create scripts for access control tables:

On the Installation Scripts page, click Create.

Click the Create Scripts for Access Control Tables link.

If you had wanted to create installation scripts for access control tables, you would click Create Script.

For this exercise, click Cancel.

About Creating Scripts to Install Files

To include other types of objects, such as cascading style sheets, images, and static files that your application references, you need to create scripts that install the files as well as bundle the files as supporting objects.

Before you begin, make sure the files you want to include have been added as Shared Components.

See Also:

"Using Custom Cascading Style Sheets," "Managing Images," and "Managing Static Files" in Oracle Database Application Express User's Guide

To create a script that installs files:

On the Installation Scripts page, click Create.

Click the Create Scripts to Install Files link.

A list of file types appear. Each object is created by its own script, but you can select to create more than one at once.

The OEHR Sample Objects application does not include any files to install.

If you had wanted to include a script you would select the appropriate scripts and click Create Scripts. The name of the script defaults to the name of the object being created, and the sequence is defaulted as well. You can alter these attributes after creation.

For each file that you install, the appropriate deinstallation statement is also written to the deinstallation script.

For this exercise, click Cancel.

Success Message

Upon completion of the supporting objects installation, either a success or failure message appears. Use these messages to give the user information they may need to continue.

For example, for a successful installation, you may want to provide instructions on running the application, such as built-in usernames and passwords. For a failed installation, you might want to tell users whom to contact or instruct them to deinstall the application.

To review the success or fail messages:

On the Installation Scripts page, click the Messages tab.

Scroll down to the Post Installation section to review the messages.

About Supporting Objects Deinstallation

The final part of Supporting Object Utility is the deinstallation process. Deinstalling enables a user who has installed your application to cleanly remove all objects created during the installation process.

On the Supporting Objects page, the Deinstallation section includes a Deinstallation script link.

Description of pck_deinstall.gif follows
Description of the illustration pck_deinstall.gif

Topics in this section include:

View the Deinstallation Confirmation Message

Review the Deinstallation Script

View the Deinstallation Success Message

View the Deinstallation Confirmation Message

When a user initiates the deinstallation process, a deinstallation message appears.

To review the deinstallation confirmation message section:

On the Supporting Object Messages page, scroll down to Deinstallation.

Scroll down to the Deinstallation section.

For the OEHR Sample Objects application, no deinstallation message is defined.

Review the Deinstallation Script

When a user selects to deinstall supporting objects, the deinstallation script runs. Unlike installation, only one script exists for deinstallation. This script should remove each object created during installation, including database objects, as well as any loaded files, cascading style sheets, or images.

To review the deinstallation script for OEHR Sample Objects:

On the Supporting Object Messages page, click the Deinstall tab.

The Deinstall Script page appears.

Click the Edit icon to the left of the script.

Notice that the drop table statements contain CASCADE CONSTRAINTS clauses. Using these clauses is the easiest way to avoid contention between foreign keys when dropping tables. If you create installation scripts for any files, the code to drop those is included in the deinstallation script for you.

For this exercise, click Cancel.

View the Deinstallation Success Message

The final part to the deinstallation process is the deinstallation success message. This is the message displayed after all the deinstallation scripts have been executed.

To review the deinstallation success message:

On the Deinstall Script page, click the Messages tab.

Scroll down to the Deinstallation section.

For OEHR Sample Objects, note the post-deinstall message.

About Supporting Objects Export

After defining your supporting objects, you can decide whether or not to include them when you export your application. You set a default value for this export setting on the Export tab.

Topics in this section include:

Review the Supporting Objects Export Setting

Where the Export Default Appears When Exporting

Review the Supporting Objects Export Setting

To review the export setting:

On the Supporting Object Messages page, click the Export tab.

Use the Export Status page to specify whether to include supporting objects in the export. For OEHR Sample Objects, note that Include Supporting Object Definitions in Export is set to Yes.

For this exercise, click Cancel.

Where the Export Default Appears When Exporting

Now that you know where to set the export default, next you learn where this setting appears in the export steps.

To see where the export setting default appears in the export steps:

Go to the Supporting Objects page by clicking the Supporting Objects breadcrumb.

From the Tasks list on the right, click Export Application.

In the Export Application section, notice that Export Supporting Object Definitions is set to Yes. If this option is set to No, your export only included your application definition.

To return to the Supporting Object Installation page, click Manage Supporting Objects on the Tasks list on the right.

About Creating Upgrade Scripts

Creating upgrade scripts enables you to modify a distributed application, but enables users to retain their existing objects. You can use upgrade scripts to add database objects, alter existing database objects (for example, add columns or change column definitions), or create new files.

If you plan to include upgrade scripts, remember to also modify your installation scripts and deinstallation scripts. Then, when new users install your application, they will have the full set of supporting objects and if the upgraded application is removed, all the objects will also be removed.

The wizard that installs the supporting objects needs to be able to determine whether to run the installation scripts or the upgrade scripts. This decision point is determined by the Detect Existing Supporting Objects query. If the query returns at least one row then the upgrade scripts are run. If the query returns no rows, the installation scripts are run. A common approach is to have the query check the Oracle data dictionary for the existence of the tables that the application depends on as shown in the following example:

SELECT 1
  FROM user_tables
 WHERE table_name in ('OEHR_ORDERS','OEHR_ORDER_ITEMS')

If your upgrade consists only of application-level changes (that is, there are no supporting objects changes) you do not need to create upgrade scripts. You can simply instruct users to install the new application, but not install supporting objects.

Utilizing Upgrade Messages

When creating an upgrade, there are four messages you can use: Welcome Message, Confirmation Message, Success Message, and Failure Message. Use these messages to inform the user that they are upgrading their supporting objects instead of just installing them.

If you distribute an application that is used as an upgrade, you should recommend that users install the application using a new application ID. This approach retains the initial application and its associated supporting object definitions. Once the user runs and reviews the upgraded application, they can then delete the prior version. Remember to also make sure users understand that they should not remove supporting objects.

About Refining Your Installation Scripts

Once you create your supporting objects, you should test them. As a best practice, be sure to:

Perform the test in another workspace, or in the same workspace using a different schema.

Export your application and include the supporting object definitions.

Then, import the application into another workspace and experience the installation process.

This will enable you to edit the messages to fit your application.

If the supporting objects are created successfully, you should run and test the application.

If the applications displays and performs as expected, delete the application and then deinstall your supporting objects.

Finally, use Object Browser to verify that all your supporting objects have been removed.

Since installation scripts are rarely correct the first time, this is typically an iterative process.

Downloading Public Packaged Applications and Sample Code

If you are using Oracle Application Express 2.2 or higher, you can download packaged applications and sample code from the Oracle Application Express Web site. Packaged applications are fully functional applications that you can view, use, and customize. Sample code is provided as packaged applications that contain a snippet of code to explain a solution.

To download public packaged applications and sample code:

In a Web browser, go to the following Web site:

http://www.oracle.com/technology/products/database/application_express/packaged_apps/packaged_apps.html

Scroll down to review the available applications or code.

Click the link for the zip file you want to download, and save the file to your computer.

Unzip the file.

Review the Readme file.

Each application includes a Readme file that contains details about the application functionality, installation procedures, how to remove sample data (if appropriate), and default user names and passwords (if applicable).

Log in to the workspace in Oracle Application Express where you want to use the packaged application or code.

Import and install the application.

Follow the same steps you performed when installing the sample objects for this guide. See "About Loading Sample Objects".

13 How to Create a Master Detail PDF Report

Oracle Application Express supports the ability to print a report by exporting a report region to PDF. Defined declaratively, report printing enables users to view and print reports that include page headings and that properly conform to specified page sizes. When users print a report, the report data is transformed to a PDF format using an externally defined report server.

In addition to enabling printing for report regions, you can also define output using report queries and report layouts that are linked to an application.

This tutorial explains how to build a master detail form, define a report query and RTF template, and then create a button to expose the new report.

This section contains the following topics:

About Oracle BI Publisher Licensing Requirements

Loading the Required Objects

Creating a Master Detail Form

Creating the Report Query

Creating the RTF Template

Creating the Report Layout

Linking the PDF Report to the Application

About Creating One PDF Containing All Orders

For additional examples on this topic, please visit the following Oracle by Examples (OBEs):

Creating PDF Reports with Oracle Application Express 3.1

http://www.oracle.com/technology/obe/apex/apex31nf/apex31rpt.htm

Utilizing Advanced Printing in Oracle Application Express 3.1

http://www.oracle.com/technology/obe/11gr1_db/appdev/apexpdf/apexpdf.htm

Creating a PDF Report with Multiple Queries

http://www.oracle.com/technology/obe/hol08/apexprnt/apexprnt_otn.htm

Including Dynamic Images in Your Report

http://www.oracle.com/technology/obe/hol08/apexprnt/apexprnt2_otn.htm

Storing and Accessing Reports in the Database

http://www.oracle.com/technology/obe/hol08/apexprnt/apexprnt3_otn.htm

Creating Reports With Dynamic Layout Selection

http://www.oracle.com/technology/obe/hol08/apexprnt/apexprnt4_otn.htm

See Also:

PDF Printing in Application Express 3.0 and "Configuring Printing for Reports" in Oracle Database Application Express User's Guide

About Oracle BI Publisher Licensing Requirements

Advanced PDF Printing requires Oracle Application Express release 3.0 or higher and a valid license of Oracle BI Publisher. If your Oracle Application Express instance is not currently configured to use BI Publisher, you can learn more about installing and configuring PDF Printing in PDF Printing in Application Express 3.0.

Viewing a Hosted Version of the Application

If you do not have a valid Oracle BI Publisher license, or have not yet installed or configured Oracle BI Publisher, you can follow the exercises in this tutorial and view a completed version of the application on apex.oracle.com.

To view hosted version of the application:

In your Web browser go to:

http://apex.oracle.com/pls/otn/f?p=15610

The hosted application appears.

Click the Edit icon adjacent to a customer.

On the Order Details page, click Print PDF of Order.

Save the PDF to your hard drive so you can view it.

Loading the Required Objects

In order to complete this tutorial, you must download and install the packaged application How To Create a Master-Detail PDF Report from Oracle Technology Network (OTN). Importing and installing this packaged application creates the required objects needed to complete this tutorial. Additionally, it also contains the final version the application you will build. That way, you can refer to it as a code reference.

Topics in this section include:

Download the Packaged Application

Import and Install the Packaged Application

Download the Packaged Application

To download the packaged application from OTN:

Download the md_pdf_howto.zip file to your computer. In your Web browser go to:

http://www.oracle.com/technology/products/database/application_express/packaged_apps/md_pdf_howto.zip

Unzip and extract the md_pdf_howto.zip file:

Microsoft Windows - Double-click the md_pdf_howto.zip file

UNIX or Linux - Enter the following command:

$ unzip md_pdf_howto.zip

Review the md_pdf_howto_readme.txt file.

Import and Install the Packaged Application

To import and install the application, How To Create a Master-Detail PDF Report:

Log in to Oracle Application Express. See "Logging In To Oracle Application Express" in Oracle Database Application Express User's Guide.

On the Workspace home page, click Application Builder.

The Application Builder home page appears.

Click the Import button.

For Specify File, specify the following:

Import file - Click Browse and go to the md_pdf_howto_installer.sql file.

File Type - Select Application, Page, or Component Export.

Verify that File Character Set is correct.

Click Next.

For File Import Confirmation, click Next to install the imported file.

The Install Application Wizard appears.

In the Install Application Wizard, specify the following:

Parsing Schema - Select the appropriate schema.

Build Status - Select Run and Build Application.

Install As Application - Select Auto Assign New Application ID.

Click Install.

For Supporting Objects, select Yes and click Next.

Confirm your selections by clicking Install.

Click the Home breadcrumb link at the top of the page.

The Application Builder home page appears.

About Checking the Available Space in Your Workspace

If you experience problems installing the How To Create a Master-Detail PDF Report application, verify the available space in your workspace. You many need to request additional storage space.

If you are a workspace administrator, you can:

Determine if you need additional storage space. See "Viewing the Workspace Overview Report" in Oracle Database Application Express User's Guide.

Request additional storage space. See "Requesting Additional Storage" in Oracle Database Application Express User's Guide.

About Deleting the Packaged Application

Deleting the How To Create a Master-Detail PDF Report application and selecting to deinstall the supporting objects completely removes all associated objects and sample data.

To delete the How To Create a Master-Detail PDF Report application:

Log in to Oracle Application Express.

On the Workspace home page, click Application Builder.

The Application Builder home page appears.

Select the How To Create a Master-Detail PDF Report application.

The Application home page appears.

On the Tasks list, click Delete this Application.

The Deinstall page appears.

To remove all associated objects and sample data, select Remove Application Definition and Deinstall Supporting Objects.

Click Deinstall.

Creating a Master Detail Form

To create a master detail form:

On the Workspace home page, click the Application Builder icon.

Select the How To Create a Master-Detail PDF Report application.

Click Create Page.

Select Form and click Next.

Select Master Detail Form and click Next.

The Master Detail Wizard appears.

On Master Table, select the following:

Table/View Owner - Select the appropriate schema.

Table/View Name - Select MD_PDF_ORDERS.

The columns in that object appear under Available Columns.

Press the Shift key to select all the columns and then click the Add button to move them to Displayed Columns.

Click Next.

On Detail Table, specify the following:

Show Only Related Tables - Accept the default, Yes.

Table/View Owner - Select the appropriate schema.

Table/View Name - Select MD_PDF_ORDER_ITEMS.

The columns in that object appear under Available Columns.

Press the Shift key to select all the columns and then click the Add button to move them to Displayed Columns.

Click Next.

On Primary Key Source:

For the Primary Key Column ORDER_ID, accept the default, Existing Trigger and click Next.

For the Primary Key Column ORDER_ITEM_ID, accept the default, Existing Trigger and click Next.

To accept the remaining defaults, click Finish.

Click Create.

A Success page appears.

View the Report

To view the new pages:

Click the Run Page icon.

The PDF Orders report appears as shown in Figure 13-1.

Figure 13-1 Md Pdf Orders Report

Description of Figure 13-1 follows
Description of "Figure 13-1 Md Pdf Orders Report"

Note that the wizard added two pages to the application, a report on the master table and a master detail form that references both tables.

To edit an order and view the master detail form, click the Edit icon.

The Master Details page appears as shown in Figure 13-2.

Figure 13-2 Master Details Page

Description of Figure 13-2 follows
Description of "Figure 13-2 Master Details Page"

Creating the Report Query

The form you created displays order items for five orders. Using standard PDF printing, you could enable region printing on the tabular form. This would result in an output that would display just the order items records and only for the selected master. To create a report that incorporates all the order information, along with the Order Items, you will create a report query. The order information will be retrieved from the session state for each order item.

To create a report query:

Go to the Report Queries page:

To return to the Application home page, click the Application link on the Developer toolbar.

Click on the Shared Components icon.

Under Reports, click Report Queries.

The Report Queries page appears.

Click Create.

For Report Query Definition, enter the following:

Report Query Name - Enter order_details.

Session State - Select Include application and session information.

The Select Items fields appear.

Select Items - Select P3_CUSTOMER_NAME, and click Add.

Repeat this procedure for:

P3_ORDER_DATE

P3_ORDER_ID

P3_ORDER_MODE

P3_ORDER_STATUS

P3_ORDER_TOTAL

P3_SALES_REP

Accept remaining defaults and click Next.

For Source Queries, enter the following:

SQL Query - Enter the following code:

SELECT LINE_ITEM_ID,
       QUANTITY,
       ORDER_ITEM_ID,
       PRODUCT_NAME,
       to_char(UNIT_PRICE,'$9,999.99') unit_price
  FROM MD_PDF_ORDER_ITEMS
 WHERE ORDER_ID = :P3_ORDER_ID

Click Next.

For Data Source for Report Layout, select XML Data and the click Download button.

This step downloads an XML file with the name of the report query, order_details.xml.

Save the resulting file to your hard drive.

You will create an RTF template using this XML file and then upload it. First, however, you must complete the process of creating the report query using a generic report layout. You will then edit the report query to reference the new report layout once it is created and uploaded.

Click Next.

For Report Layout File, browse to and select the order_details.xml file you saved.

Click Next.

Notice the URL that displays. This is the URL that will be used to call this report from within your application.

Click Finish.

Next, you need to create an RTF template using this XML file.

Creating the RTF Template

To edit the XML produced from your report query, you need the Oracle BI Publisher Desktop. When properly loaded, Oracle BI Publisher Desktop adds a new menu option to Microsoft Word.

Topics in this section include:

Download Oracle BI Publisher Desktop

Load the XML Details

Insert the Fields

Include Line Items

See Also:

Oracle BI Publisher Desktop White Papers and Demonstrations

Download Oracle BI Publisher Desktop

If you do not have the Desktop loaded, you can download it here:

http://www.oracle.com/technology/software/htdocs/devlic.html?url=/technology/software/products/ias/htdocs/101320bi.html

See Also:

"About Oracle BI Publisher Licensing Requirements"

Load the XML Details

To load the XML generated by your report query:

Open Microsoft Word.

From the Oracle BI Publisher menu, select Data and then Load Sample XML Data.

Select the file you generated when creating report query, order_details.xml.

The following message appears:

Data loaded successfully

Click Ok.

Note that nothing appears on the page.

Insert the Fields

To insert the order columns:

From the Oracle BI Publisher menu, select Insert and then Field.

Select P3 Customer Name and click Insert.

Continue to insert each of the order columns.

Exit the Field dialog box, click Close.

Although each of the order items displays on the page, they are in one long string.

Edit the page so that each item displays on a separate line and is prefaced by a descriptive label. Consider the following example:

Customer: P3_CUSTOMER_NAME
Order Date: P3_ORDER_DATE
Order ID: P3_ORDER_ID
Order Mode: P3_ORDER_MODE
Order Status: P3_ORDER_STATUS
Order Total: P3_ORDER_TOTAL
Sales Rep: P3_SALES_REP

Include Line Items

To include line items:

Insert a few blank lines below your order details.

From the Oracle BI Publisher menu, select Insert and then Table Wizard.

Accept the default, Table, and click Next.

For Grouping Field, select DOCUMENT/REGION/ROWSET/ROW and click Next.

Select each field and move it to the right column. Click Next.

You do not need to make any grouping selections since your report will select just one order.

Click Next.

For Sort By, select Line Item Id and click Next.

For Labels, edit the following:

Line Item Id - Change to Line Item.

Order Item Id - Change to Order Item.

Click Finish.

Your basic framework is created and should resemble Figure 13-3.

Figure 13-3 Report Layout Template

Description of Figure 13-3 follows
Description of "Figure 13-3 Report Layout Template"

To define a header and footer, from the View menu, select Header and Footer.

For example, the header could contain the name of the report (for example, My Order Report) and the footer could contain page numbers or the date the report was executed. You can also customize the font family or font size.

Save your changes:

From the File menu, select Save As.

For Save as type, select Rich Text Format (*.rtf).

For File Name, enter order_details.rtf.

Exit Microsoft Word.

About Including Variables in Your RTF

You can include variables in the header and footer of your RTF. For example, the RTF file used in the sample pages included in the How To Create a Master-Detail PDF Report application include the date the report was executed and the user that executed the report.

To download and view this RTF:

Go to the Report Layouts page:

Click on the Shared Components icon.

Under Reports, click Report Layouts.

The Report Queries page appears.

Click order_details2.

Click Download and save order_details2.rtf to your hard drive.

Open order_details2.rtf in Microsoft Word and note the variables included in the footer.

Creating the Report Layout

Once you complete your report layout template, you need to upload it to Application Builder and associate it with your report query.

Topics in this section include:

Create a Report Layout

Associate the Report Layout and Report Query

Create a Report Layout

To create a report layout:

Go to the Shared Components page:

Click the Shared Components breadcrumb.

Under Reports, click Report Layouts.

The Report Layouts page appears.

Click Create.

For Layout Type, select Named Columns and click Next.

For Layout Type, specify the following:

For Layout Name, enter order details.

For Report Layout File, click Browse and select order_details.rtf.

Click Create Layout.

Associate the Report Layout and Report Query

To associate the report layout and report query:

Go to the Shared Components page. Click the Shared Components breadcrumb.

Under Reports, click Report Queries.

Edit the query by clicking order_details.

Under Report Query Attributes, for Report Layout, select order details.

Click Apply Changes.

Linking the PDF Report to the Application

In this exercise, you link the PDF report to the application by creating a button.

Topics in this section include:

Create a Button

Run the Page

Create a Button

To create a button:

Go to the Page Definition for the Master Detail page:

Click the Application breadcrumb link.

Select Master Detail.

Under Buttons, click the Create icon.

Figure 13-4 Create Icon

Description of Figure 13-4 follows
Description of "Figure 13-4 Create Icon"

For Button Region, select Md Pdf Orders and click Next.

This selection positions the button in the top (or master) region.

For Button Position, select accept the default, Create a button in a region position, and click Next.

For Button Attributes:

Button Name - Enter PRINT.

Label - Enter Print PDF of Order.

For Button Type, accept the default, Template Driven.

For Action, select Download printable report query.

Click Next.

For Button Template, accept the default and click Next.

For Display Properties:

Position - Select Region Template Position #CREATE#.

This positions the button to the right of the Apply Changes button.

Accept the remaining defaults and click Next.

For Branching:

Report Query - Select order_details.

Click Next.

For Conditional Display:

Condition Type - Select Value of Item in Express 1 Is NOT NULL.

Expression 1 - Enter P3_ORDER_ID.

By creating this condition, the print button will not display when you are creating a new order.

Click Create Button.

Run the Page

To run the page:

Click the Run Page icon in the upper right corner as shown in Figure 13-5.

Figure 13-5 Run Page Icon

Description of Figure 13-5 follows
Description of "Figure 13-5 Run Page Icon"

When the report appears, click Cancel to return to the Md Pdf Order page.

Click the Edit icon to select another order.

Your Master Detail page should resemble Figure 13-6. Note the new Print PDF or Order button.

Figure 13-6 Revised Master Detail Page

Description of Figure 13-6 follows
Description of "Figure 13-6 Revised Master Detail Page"

If you do not have an Oracle BI Publisher license, or have not yet installed or configured Oracle BI Publisher, you will not be able to save the report as a PDF.

To view a fully functional version of this application:

View the hosted version on apex.oracle.com. See "Viewing a Hosted Version of the Application".

View the example pages included with the demonstration application. Return to the Application home page, run the Orders page, click Edit to edit an order, and click Print PDF Order.

About Creating One PDF Containing All Orders

This tutorial created a report that was specific to one order. You could also create the same report without passing in the Order ID. This would create one PDF that would contain all orders. To accomplish this, you would:

Create one report query that returns all the required columns. There would be no need to include session state variables.

Load the resulting XML into Microsoft Word just as you did in this tutorial and use the Table Wizard.

When prompted to specify Groupings, select the columns that you want to use as your master.

The resulting display will include the grouped columns above a table that contains your detail records. You can then add labels and customize the display. When the report is run, each master value will display on a new page.

14 How to Design an Issue Tracking Application

This tutorial describes how to plan, design and populate data objects for an example Issue Tracking application. After completing this tutorial, you can go on to Chapter 15, "How to Build and Deploy an Issue Tracking Application" to implement and deploy the application user interface to the data objects designed in this chapter.

A completed sample Issue Tracker application and supporting scripts are available on the Oracle Technology Network. Go to the following location and navigate to Packaged Applications and then select Issue Tracker:

http://www.oracle.com/technology/products/database/application_express/index.html

Note:

This tutorial takes approximately one to two hours to complete. It is recommended that you read through the entire tutorial first to become familiar with the material before you attempt specific exercises.

Topics in this section include:

Planning and Project Analysis

Designing the Database Objects

Implementing Database Objects

Loading Demonstration Data

For additional examples on this topic, please visit the following Oracle by Examples (OBEs):

Manipulating Database Objects

http://www.oracle.com/technology/obe/hol08/apexintro/apex3.1.1_a/apex3.1.1_a_otn.htm

Planning and Project Analysis

Effective project management is the key to completing any project on time and within budget. Within every project there are always multiple issues that need to be tracked, prioritized, and managed.

In this business scenario, MRVL Company has several projects that must be completed on time for the company to be profitable. Any missed project deadline will result in lost revenue. The company's project leads use various methods to track issues, including manually recording statuses in notebooks, organizing issues in text documents, and categorizing issues by using spreadsheets.

By creating a hosted application in Oracle Application Express, project leads can easily record and track issues in one central location. This approach offers each project lead access to just the data they need and makes it easier for management to determine if critical issues are being addressed.

Planning and Project Analysis

Before beginning development on an Oracle Application Express application, you first need to define application requirements. Then, you use the defined requirements to design a database and an outline that describes how the user interface accepts and presents data.

For this business scenario, the project leads establish requirements that define the information that must be tracked, security requirements, data management functions, and how to present data to users.

Topics in this section include:

Gather the Necessary Data

Define Security Requirements

Select Data Management Functions

Select Data Presentation Functions

Define Special Function Requirements

Gather the Necessary Data

Currently, each project lead tracks information slightly differently. Together, everyone agrees that the application should include the following information:

Summary of the issue

Detailed description of the issue

Who identified the issue

The date on which the issue was identified

Which project the issue is related to

Who the issue is assigned to

A current status of the issue

Priority of the issue

Target resolution date

Actual resolution date

Progress report

Resolution summary

Define Security Requirements

Because the project leads are concerned about everyone having access to all the information, they agree upon the following access rules:

Each team member and project lead is only assigned to one project at a time

Each team member and project lead must be assigned to a project

Managers are never assigned to a specific project

Only managers can define and maintain projects and people

Everyone can enter new issues

Once assigned, only the person assigned or a project lead can change data about the issue

Management needs views that summarize the data without access to specific issue details

Select Data Management Functions

Next, the project leads determine how information will be entered into the system. For this project, users must be able to:

Create issues

Assign issues

Edit issues

Create projects

Maintain projects

Create people

Maintain people information

Maintain project assignments

Select Data Presentation Functions

Once the data is entered into the application, users need to view the data. The team decides that users must be able to view the following:

All issues by project

Open issues by project

Overdue issues, by project and for all

Recently opened issues

Unassigned issues

Summary of issues by project, for managers

Resolved issues by month identified

Issue resolution dates displayed on a calendar

Days to Resolve Issues by person

Define Special Function Requirements

Finally, the project leads determine that the application must support the following special functions:

Notify people when an issue is assigned to them

Notify the project lead when any issue becomes overdue

Designing the Database Objects

Once you have defined the database requirements, the next step is to turn these requirements into a database design and an outline that describes how the user interface accepts and presents data. In this step you need to think about how information should be organized in the tables in the underlying database. Given the requirements described "Planning and Project Analysis", for this project you need to create three tables:

Projects tracks all current projects

People contains information about who can be assigned to handle issues

Issues tracks all information about an issue, including the project to which it is related and the person assigned to the issue

In addition to the tables, you also need to create additional database objects, such as sequences and triggers, to support the tables. System generated primary keys will be used for all tables so that all the data can be edited without executing a cascade update.

The data model designed for this exercise will look like Figure 14-1.

Figure 14-1 Data Model for Issue Tracker Database Objects

Description of Figure 14-1 follows
Description of "Figure 14-1 Data Model for Issue Tracker Database Objects"

Topics in this section include:

About the Projects Table

About the People Table

About the Issues Table

About the Projects Table

Each project must include project name, project start date, target date, and actual end date columns. These date columns help determine if any outstanding issues are jeopardizing the project end date. Table 14-1 describes the columns to be included in the Projects table.

Table 14-1 Project Table Details

Column Name | Type | Size | Not Null? | Constraints | Description
project_id | number | n/a | Yes | Primary key | A unique numeric identification for each project. Populated by a sequence using a trigger.
project_name | varchar2 | 255 | Yes | Unique key | A unique alphanumeric name for the project.
start_date | date | n/a | Yes | None | The project start date.
target_end_date | date | n/a | Yes | None | The targeted project end date.
actual_end_date | date | n/a | No | None | The actual end date.
created_on | date | n/a | Yes | None | Date the record was created.
created_by | varchar2 | 255 | Yes | None | The user who created the record.
modified_on | date | n/a | Yes | None | The date the record was last modified.
modified_by | varchar2 | 255 | Yes | None | The user who last modified the record.

About the People Table

Each person will have a defined name and role. Project leads and team members will also have an assigned project. To tie the current user to their role within the organization, email addresses will be used for user names.

In order to associate the current user to a person, a username column will be added to the people table. This allows flexibility when deciding on the authentication mechanism and also allows for an authorization scheme that can determine who the person is that has logged on and if they have access to the application.

As a standard, add audit columns to each table. They do not need to be identified during analysis because they are added consistently to each table just before implementation.

Table 14-2 describes the columns that will be included in the People table.

Table 14-2 People Table Details

Column Name | Type | Size | Not Null? | Constraints | Description
person_id | number | n/a | Yes | Primary key | A numeric ID that identifies each user. Populated by a sequence using a trigger.
person_name | varchar2 | 255 | Yes | Unique key | A unique name that identifies each user.
person_email | varchar2 | 255 | Yes | None | User email address.
person_role | varchar2 | 30 | Yes | Check constraint | The role assigned to each user.
username | varchar2 | 255 | Yes | Unique Key | The username of this person. Used to link login to person's details.
assigned_project | number | n/a | No | None | The project this person is assigned to.
created_on | date | n/a | Yes | None | Date the record was created.
created_by | varchar2 | 255 | Yes | None | The user who created the record.
modified_on | date | n/a | Yes | None | The date the record was last modified.
modified_by | varchar2 | 255 | Yes | None | The user who last modified the record.

Note:

For the purposes of this exercise, this application has been simplified. User data is usually much more elaborate and is often pulled from a corporate Human Resource system. Also, users typically work on more than one project at a time. If the roles that are assigned to a user need to be dynamic, you would implement roles as a separate table with a foreign key that relates to the people table.

About the Issues Table

When the project leads defined their application requirements, they decided to track separate issues assigned to each person. Issues will be included in columns along with additional columns to provide an audit trail. The audit trail will track who created the issue, when it was created, as well as who modified the issue last and on what date that modification was made.

Table 14-3 describes the columns to be included in the Issues table.

Table 14-3 Issue Table Details

Column Name | Type | Size | Not Null? | Constraints | Description
issue_id | number | n/a | Yes | primary key | A unique numeric ID that identifies an issue. Populated by a sequence using a trigger.
issue_summary | varchar2 | 255 | Yes | None | A brief summary of the issue.
issue_description | varchar2 | 4000 | No | None | A detailed description of the issue.
identified_by_person_id | number | n/a | Yes | foreign key to People | The user who identifies the issue.
identified_date | date | n/a | Yes | None | The date the issue was identified
related_project | number | n/a | Yes | foreign key to Projects | Project related to the issue.
assigned_to | integer | n/a | No | foreign key to eba_it_people | The person who owns this issue.
status | varchar2 | 30 | Yes | check constraint | The issue status. Automatically set to Open when new and set to Closed when actual resolution date entered.
priority | varchar2 | 30 | No | check constraint | The priority of the issue.
target_resolution_date | date | n/a | No | None | The target resolution date.
progress | varchar2 | 4000 | No | None | The progress of the issue.
actual_resolution_date | date | n/a | No | None | Actual resolution date of the issue.
resolution_summary | varchar2 | 4000 | No | None | Resolution summary.
created_on | date | n/a | Yes | None | Date the record was created.
created_by | varchar2 | 255 | Yes | None | The user who created the record.
modified_on | date | n/a | Yes | None | The date the record was last modified.
modified_by | varchar2 | 255 | Yes | None | The user who last modified the record.

Note:

A real-world application might need more extensive auditing. For example, you might need to track each change to the data rather than just the last change. Tracking each change to the data would require an additional table, linked to the issues table. If the valid priorities assigned to issues need to be dynamic, you would be required to add a separate table with a foreign key that relates to the issues table.

Implementing Database Objects

This first step in building an application is to create the database objects.

Topics in this section include:

Additional Database Objects Needed

About Building Database Objects

Create and Run a Script to Build Database Objects

View the Created Database Objects

Additional Database Objects Needed

To populate the primary key values of the tables needed for this application, a sequence can be used. Another method is to create a function to provide a unique value. The latter method is used for this application. The function is created as part of a package named for the application. During implementation of the user interface, additional functions and procedures may be needed; they can be added to this one.

The DDL for the package specification and body is shown below. The package specification is created first, followed by the package body. The package body is created last because the body usually refers to tables that must already be specified. In this example, however, the body has no references to the tables.

About Building Database Objects

There are several ways to create objects in Oracle Application Express. You can:

Create an Object in Object Browser. Use Object Browser to create tables, views, indexes, sequences, types, packages, procedures, functions, triggers database links, materialized views, and synonyms. A wizard walks you through the choices necessary to create the selected database object. To create an object in Object Browser, navigate to SQL Workshop, then Object Browser, and click Create. See "Managing Database Objects with Object Browser" in Oracle Database Application Express User's Guide.

Execute SQL Commands. Run SQL Commands by typing or pasting them into the SQL Commands. To access SQL Commands, click the SQL Workshop icon on Workspace home page and then click SQL Commands. See "Using SQL Commands" in Oracle Database Application Express User's Guide.

Upload a script. Upload a script to the SQL Script Repository that contains all the necessary create object statements. To upload a script, click SQL Workshop on the Workspace home page, click SQL Scripts and then click Upload. See "Uploading a SQL Script" in Oracle Database Application Express User's Guide.

Create script online. Create a script online in the Script Repository. You will use this method to create database objects for this exercise. To create a script online, click the SQL Workshop icon on the Workspace home page, select SQL Scripts and then click Create. See "Creating a SQL Script in the Script Editor" in Oracle Database Application Express User's Guide.

For this exercise, you create and run a script.

Create and Run a Script to Build Database Objects

To build database objects by creating a script:

Log in to Oracle Application Express.

On the Workspace home page, click SQL Workshop and then SQL Scripts.

Click Create.

In the Script Editor:

For Script Name, enter DDL for Issue Tracker Application.

Copy the data definition language (DDL) in "Creating Application Database Objects DDL" and paste it into the script.

Click Save.

On the SQL Scripts page, click the DDL for Issue Tracker Application icon.

The Script Editor appears.

Click Run.

A summary page appears with a confirmation request.

Click Run again to confirm.

The Manage Script Results page displays a message that the script has been submitted for execution.

View the Created Database Objects

You can view database objects using Object Browser.

To view database objects in Object Browser:

Return to the Workspace home page. Click the Home breadcrumb link.

On the Workspace home page, click SQL Workshop and then Object Browser.

From the Object list on the left side of the page, select Tables.

To view the details of a specific object, select one of the following tables:

IT_ISSUES

IT_PEOPLE

IT_PROJECTS

The tables will appear similar to those shown in Figure 14-2, Figure 14-3 and Figure 14-4.

Figure 14-2 IT_ISSUES Table

Description of Figure 14-2 follows
Description of "Figure 14-2 IT_ISSUES Table"

Figure 14-3 IT_PEOPLE Table

Description of Figure 14-3 follows
Description of "Figure 14-3 IT_PEOPLE Table"

Figure 14-4 IT_PROJECTS Table

Description of Figure 14-4 follows
Description of "Figure 14-4 IT_PROJECTS Table"

See Also:

"Managing Database Objects with Object Browser" in Oracle Database Application Express User's Guide.

Loading Demonstration Data

Once you have created all the necessary database objects, the next step is to load data into the tables. You can manually load data or write and execute a script using the import functionality available in SQL Scripts. In the following exercise, however, you use SQL Scripts to load demonstration data. To allow the demonstration data to be created, removed and created again, the creation scripts have been wrapped into a package. You will first load and execute a script that will create the package specification and package body. You will then use the Command Processor to execute the procedures from within that new package.

To load demonstration data:

Click the SQL Workshop breadcrumb link.

Click SQL Scripts.

Click Create.

In the Script Editor, specify the following:

Script Name - Enter Load Data.

Copy the script in "Creating Issues Script" and paste it into the script.

Click Save.

On the SQL Scripts page, click the Load Data icon.

The Script Editor appears.

Click Run.

A summary page appears.

Click Run again.

The Run Script page displays with a request to confirm.

Click Run to confirm.

The Mange Script Results page displays a message that the script has been submitted for execution.

Click the SQL Workshop breadcrumb link.

Click SQL Commands.

To execute the procedures that load data into each table, enter the following:

begin
    it_sample_data.create_sample_projects;
    it_sample_data.create_sample_people;
    it_sample_data.create_sample_issues;
end;

Click Run.

All the Issue Tracker Application objects have been designed, created and populated with data. Now, you can continue on and complete Chapter 15, "How to Build and Deploy an Issue Tracking Application" to create the User Interface to these objects.

15 How to Build and Deploy an Issue Tracking Application

This tutorial describes how to create and deploy an application that tracks the assignment, status, and progress of issues related to a project. This tutorial walks you through all the steps necessary to create a robust issue tracking application. Before following the steps outlined in this chapter you must have completed planning the project, creating the underlying database objects, and loading demonstration data, as described in Chapter 14, "How to Design an Issue Tracking Application".

A completed sample Issue Tracker application and supporting scripts are available on the Oracle Technology Network. Go to the following location and navigate to Packaged Applications and then select Issue Tracker:

http://www.oracle.com/technology/products/database/application_express/index.html

Note:

You must complete Chapter 14, "How to Design an Issue Tracking Application" before building the Issue Tracker application. This tutorial takes approximately two to three hours to complete. It is recommended that you read through the entire document first to become familiar with the material before you attempt specific exercises.

Topics in this section include:

Issue Tracker Application Overview

Building a Basic User Interface

Adding Advanced Features

Deploying Your Application

Issue Tracker Application Overview

This section provides an overview of the Issue Tracker application designed and implemented in this tutorial. Before building this application it is helpful to understand:

Issue Tracker User Interface

Issue Tracker Architecture

Issue Tracker User Interface

The Issue Tracker user interface is designed to support tracking and maintaining of issues, projects, and users. The application pages are organized as shown in Figure 15-1, "Issue Tracker User Interface".

Figure 15-1 Issue Tracker User Interface

Description of Figure 15-1 follows
Description of "Figure 15-1 Issue Tracker User Interface"

Issue Tracker Architecture

After building this application, you will have 15 pages. The Application Builder home page for the Issue Tracker application will look similar to the one in Figure 15-2, "Issue Tracker Pages".

Figure 15-2 Issue Tracker Pages

Description of Figure 15-2 follows
Description of "Figure 15-2 Issue Tracker Pages"

Each page serves a particular tracking function as described in Table 15-1, "Overview of Each Issue Tracker Page".

Table 15-1 Overview of Each Issue Tracker Page

Name and Number | Parent Breadcrumb Entry | Purpose | Section that describes how to create this page:
1 - Home |  | Application Home page that links to top level pages: Projects, Users, Issues, Reports and Dashboard. | Create the Basic Application
2 - Projects | Home | Project report page used to display and search projects. Links to Project Details page. | Add Pages to Maintain Projects
3 - Project Details | Projects | Project details form used to view details for a specific project and to add, delete, and edit a project. | Add Pages to Maintain Projects
4 - Users | Home | Users report page used to display and search users. Links to User Information page. | Add Pages to Track Users
5 - User Information | Users | User information form used to view information for a specific user and to add, edit and delete a user. | Add Pages to Track Users
6 - Issues | Home | Issues report page used to display and search Issues. Links to Issue Details page. | Add Pages to Track Issues
7 - Issue Details | Issues | Issue Details form used to view information for a specific issue and to add, edit and delete an issue. | Add Pages to Track Issues
8 - Assign Open Issues | Reports | Displays all unassigned issues and allows you to assign to a person, identify a related project, change status and change priority. | Add Pages for Summary Reports
9 - Issue Summary by Project | Reports | Provides a report of a variety of issue parameters per project. | Add Pages for Summary Reports
10 - Resolved by Month Identified | Reports | Shows a visual depiction number of issues solved each month. | Add Pages for Summary Reports
11 - Target Resolution Dates | Reports | Displays a calendar with entries for each target resolution date. | Add Pages for Summary Reports
12 - Average Days to Resolve | Reports | The average number of days it took each person to resolve their issues is shown as a bar chart. | Add Pages for Summary Reports
14 - Reports | Home | This is a landing page for all the summary reports: Assign Open Issues, Issue Summary by Project, Resolved by Month Identified, Target Resolution Dates, Average Days to Resolve. | Add Pages for Summary Reports
18 - Dashboard | Home | A snapshot of Overdue Issue, Unassigned Issues, Recently Opened Issues, and Open Issues by Project is displayed. | Add a Dashboard Page
101 - Login |  | Application login page. | Create the Basic Application

Building a Basic User Interface

After you create the objects that support your application and load the demonstration data, as described in Chapter 14, "How to Design an Issue Tracking Application", the next step is to create a user interface. In this exercise, you use the Create Application Wizard in Application Builder to create an application and then create the pages that support the data management and data presentation functions described in "Planning and Project Analysis".

Topics in this section include:

Create the Basic Application

Add Navigation Image List to Home Page

Add Pages to Maintain Projects

Add Pages to Track Users

Add Pages to Track Issues

Add Pages for Summary Reports

Add a Dashboard Page

Create the Basic Application

The Create Application Wizard is used to create an application containing pages that enable users to view reports on and create data for the selected tables within a schema. Alternatively, you can create an application first and then add pages to it. As the application requirements include customized overview pages, for this exercise you will use the latter approach.

This section includes the following topics:

Create the Application

Add a Logo to the Application

Run the Application

Create the Application

To create the application:

Log in to Oracle Application Express.

On the Workspace home page, click Application Builder.

Click Create.

For Method, select Create Application and click Next.

For Name:

Name - Enter Issue Tracker.

Create Application - Select From scratch.

Schema - Select schema containing loaded IT data objects.

Click Next.

Under Add Page:

Select Page Type - select Blank.

Page Name - enter Home.

Click Add Page.

Click Next.

For Tabs, select One Level of Tabs and click Next.

For Shared Components, accept the default, No, and click Next.

For Attributes:

Date Format - Enter DD-MON-YYYY, or select 12-JAN-2004 from the select list

Click Next.

For User Interface, select Theme 20 and click Next.

Click Create.

Add a Logo to the Application

To add an Issue Tracker logo to the application:

Click Shared Components.

Under Application, click the Definition link.

On the Definition page, click the Logo tab at the top.

For Logo Type, select Text (requires Application Express 2.2 or greater).

For Logo, enter Issue Tracker 1.0.

For Logo Attributes, select White Text from the drop down list.

Click Apply Changes.

Run the Application

To view the application:

Click the Application home breadcrumb link.

Click the Run Application icon.

When prompted, enter your workspace user name and password and click Login. See "About Application Authentication".

This authentication is part of the default security of any newly created application. As shown in Figure 15-3, the home page appears.

Figure 15-3 Initial Home Page

Description of Figure 15-3 follows
Description of "Figure 15-3 Initial Home Page"

Although the page has no content, notice that the Create Application Wizard has created the following items:

Logo - The Issue Tracker 1.0 logo is displayed in top left corner.

Navigation Links - A navigation bar entry displays in the upper left of the page. Logout enables the user to log out of the application.

Developer Links - The Developer toolbar appears on the page. These links only display if you are logged in as a developer. Users who only have access to run the application cannot see these links.

Click Application on the Developer toolbar to return to the Application home page.

Notice that the Create Application Wizard also created a Login page.

Once you have created the basic application structure, the next step is to add content to the Home page.

Add Navigation Image List to Home Page

Now you need to add a horizontal list of images to help the user navigate to the top level pages of the application.

When you complete this section the Home page will look like Figure 15-4.

Figure 15-4 Home Page with Navigation Image List

Description of Figure 15-4 follows
Description of "Figure 15-4 Home Page with Navigation Image List"

Note:

The navigation links below each image will not work until you create each of the corresponding top level pages. For example, when you complete the Add Pages to Maintain Projects section, the Projects link will display the Projects page.

This section covers the following topics:

Create a List of Images

Create a Region to Contain the List of Images

Create a List of Images

To create a horizontal list of images to navigate by:

Click the Application home breadcrumb.

Click Shared Components.

Under Navigation, click Lists.

Click Create.

For List make these changes:

Name - Enter Main Menu

List Template - Select Horizontal Images with Label List

Click Create.

To add Dashboard, Project, Issues, Reports, and Users images to the list:

Click Create List Entry >.

To add a Dashboard image, under Entry, make these changes:

Sequence - Enter 5.

Image - Enter menu/dashboard_bx_128x128.png

List Entry Label - Enter Dashboard.

Under Target, for Page, enter 18.

Click Create and Create Another.

To add a Projects image, under Entry, make these changes:

Sequence - Enter 10.

Image - Enter menu/globe_bx_128x128.png

List Entry Label - Enter Projects.

Under Target, for Page, enter 2.

Click Create and Create Another.

To add an Issues image, under Entry, make these changes:

Sequence - Enter 20.

Image - Enter menu/shapes_bx_128x128.png

List Entry Label - Enter Issues.

Under Target, for Page, enter 6.

Click Create and Create Another.

To add a Reports image, under Entry, make these changes:

Sequence - Enter 30.

Image - Enter menu/folder_bx_128x128.png

List Entry Label - Enter Reports.

Under Target, for Page, enter 14.

Click Create and Create Another.

To add a Users image, under Entry, make these changes:

Sequence - Enter 100.

Image - Enter menu/addresses_bx_128x128.png

List Entry Label - Enter Users.

Under Target, for Page, enter 4.

Click Create.

Create a Region to Contain the List of Images

Now create a region on the Home page to display the list of images. You need to remove the default Home region and create another of type list to contain the Main Menu list of images.

To create a region containing the list of images:

Click the Application home breadcrumb.

Click the icon, 1 - Home, for the Home page

Under Regions, select the Home region.

Click Delete.

To confirm, click Delete Region.

Under Regions, select the Create icon.

For region type, select List and click Next.

For Display Attributes, make these changes:

Title - Enter Home.

Region Template - Select No Template.

Sequence - Enter 3.

Click Next.

For Source, select Main Menu for List.

Click Create List Region.

Under Regions, click Home region.

Scroll down to Header and Footer. Enter the following for Region Header:

<p>Use this application to track issues as they arise for projects within your organization.<p>

Click Apply Changes.

To see the image list on the Home page, click the Run Application icon on the Application's home page. The Home page should look like Figure 15-5, "Home Page with Navigation Image List".

Figure 15-5 Home Page with Navigation Image List

Description of Figure 15-5 follows
Description of "Figure 15-5 Home Page with Navigation Image List"

Add Pages to Maintain Projects

Now you need to create pages that enable users to view and add project data to tables. To accomplish this, you use the Form on a Table with Report Wizard. This wizard creates a report page and a form page for the IT_PROJECTS table.

Topics in this section include:

Overview of Project Pages

Create a Tab Set for this Application

Create Pages for Maintaining Projects

Refine the Appearance of the Projects Report Page

Refine the Project Details Page

Run Project Page and Project Details Page

Note:

If you are already familiar with this application, skip "Overview of Project Pages" and proceed to "Create a Tab Set for this Application".

Overview of Project Pages

The created report page is the Projects page and the form page is the Project Details page. When you complete this section, your project pages will be similar to the Project page shown in Figure 15-6, "Projects Page", and the Project Details page shown in Figure 15-7, "Project Details Page When Adding a Project" and Figure 15-8, "Project Details Page When Editing a Project".

Figure 15-6 Projects Page

Description of Figure 15-6 follows
Description of "Figure 15-6 Projects Page"

Figure 15-7 Project Details Page When Adding a Project

Description of Figure 15-7 follows
Description of "Figure 15-7 Project Details Page When Adding a Project"

Figure 15-8 Project Details Page When Editing a Project

Description of Figure 15-8 follows
Description of "Figure 15-8 Project Details Page When Editing a Project"

Projects Page (2 - Projects)

This page is a report of all projects in the database. Components included on this page are described as follows:

Project Name: The name of the project.

Start Date: The date the project was started.

Target End Date: The date the project is scheduled to be completed.

Actual End Date: The date the project was actually completed.

Search region: A filtered report can be obtained by selecting search criteria and clicking the Go button.

Edit icon: To edit project information, click on the edit icon to the left of the project name. The Project Details page is displayed showing the selected project's information.

Add Project button: A new project can be added to the database by clicking this button. An empty Project Details page is displayed for you to enter specific project information.

Project Details Page (3 - Project Details)

This is a form that allows you to edit project details, and add a new project to the database. When you click the Add Project button or an edit icon on the Projects page this detail page is shown. All fields are empty and the Audit Information is not included when adding a new project. Components included on this page are described as follows:

Cancel: Returns you to the Project page without submitting any unapplied changes.

Delete: Removes the project from the database after getting an OK response from a delete confirmation message. This button is displayed when a project is being edited and is not displayed when adding a project.

Apply Changes: Commits any project changes to the database. This button is displayed when a project is being edited and is not displayed when adding a project.

Create: Adds the project to the database. This button is displayed when a project is being added and is not displayed when editing a project.

Project Details: This region allows you to enter project details.

Audit Information: When this region is expanded, the project audit information is displayed. Audit information cannot be edited. Audit information is automatically updated for this project when the project is created or modified. This region is only included when a project is being edited.

Create a Tab Set for this Application

A default tab set, TS1, was created when the application was created. Next you will change the name of this Tab set to be used when creating each new page.

To rename a Tab Set:

Click the Application home breadcrumb.

Click Shared Components.

Under Navigation, select Tabs.

Click Rename Standard Tab Set link on right panel.

Click TS1.

For New Tab Set Name, enter Issue Tracker and click Next.

To confirm, click Rename Tab Set.

The Issue Tracker tab set is now ready to have tabs added to it as each new page is added by the Create Page Wizard.

Create Pages for Maintaining Projects

To create pages for maintaining the IT_PROJECTS table:

On the Application home page, click Create Page.

Select Form and click Next.

Select Form on a Table with Report and click Next.

For Table/View Owner, select the appropriate schema and click Next.

For Table/View Name, select IT_PROJECTS and click Next.

For Define Report Page:

Implementation - Select Interactive.

Page Number - Enter 2

Page Name - Enter Projects.

Region Title - Enter Projects

Region Template - Select No Template.

Breadcrumb - Select Breadcrumb.

Create Breadcrumb Entry section appears.

Entry Name - Enter Projects.

Select Parent Entry - Select Home link.

Accept the remaining defaults and click Next.

For Tab Options, select Use an existing tab set and create a new tab within the existing tab set.

The New Tab Label field appears.

For Tab Set, select Issue Tracker(Home).

For New Tab Label, enter Projects and click Next.

For Select Column(s), select PROJECT_ID, PROJECT_NAME, START_DATE, TARGET_END_DATE, ACTUAL_END_DATE, and click Next.

Note that Project Name is unique and identifies the project. The ID was added to simplify the foreign key and enable cascading updates.

For Edit Link Image, select the first option, and click Next.

For Define Form Page under Create Form Page:

Page - Enter 3.

Page Name - Enter Project Details.

Region Title - Enter Project Details.

Region Template - Select Form Region.

For Define Form Page under Create Breadcrumb Entry:

Entry Name - Enter Project Details.

Click Next.

For Primary Key, accept the default, PROJECT_ID and click Next.

For Define the source for the primary key columns, accept the default, Existing Trigger, and click Next.

For Select Column(s), select PROJECT_NAME, START_DATE, TARGET_END_DATE, ACTUAL_END_DATE, and click Next.

Under Identify Process Options, accept the defaults for Insert, Update and Delete, and click Next.

Review your selections and click Finish.

Refine the Appearance of the Projects Report Page

The fields on the Projects page need to be edited and the name of the Create button needs to be changed to Add Project.

Hide PROJECT_ID Column and Add an Error Message

To edit fields:

Click Application on the Developer toolbar.

On the Application home page, click 2 - Projects.

Under Regions, click Interactive Report next to Projects.

For PROJECT_ID, select Hidden for Display Text As.

Scroll down to Pagination, for When no Data Found Message, enter No projects found.

At the top of the page, click Apply Changes.

Change Create Button to Add Project > Button

To modify button:

On edit page for Page 2, under Buttons select the Create button.

Change Text Label/Alt from Create to Add Project >, select Apply Changes.

Click the Run Page icon.

As shown in Figure 15-9, the newly created report displays the demo data.

Figure 15-9 Refined Projects Page

Description of Figure 15-9 follows
Description of "Figure 15-9 Refined Projects Page"

Refine the Project Details Page

Next, you need to customize the Project Details page to make the Project Name field larger and the date fields smaller. You also need to add an Audit Information region that only displays when a project is being edited and add a validation that checks if the target and actual end dates are after the start date.

Edit Fields

To make the Project Name field larger and the date fields smaller:

Go to the Page Definition for Page 3, Project Details:

From the Developer toolbar, click Application.

Click 3 - Project Details.

Under Items, click the Edit All icon.

The Edit All icon resembles a small grid with a pencil on top of it.

Scroll to the right and locate the Width column:

For Project Name, enter 60.

For Start Date, enter 12.

For Target End Date, enter 12.

For Actual End Date, enter 12.

Click Apply Changes.

Return to the Page Definition. Click the Edit Page icon in the upper right corner. The Edit Page icon resembles a small green piece of paper and pencil.

Add an Audit Report Region to Display Only When there is Something to Display

To add an Audit Report region at the bottom of the Project Details page:

On edit page for Page 3, under Regions, select Create button.

Select Report, and click Next.

Select SQL Report, and click Next.

For Title, enter Audit Information.

For Region Template, select Hide and Show Region, and click Next.

For Enter SQL Query or PL/SQL function returning SQL Query, enter:

SELECT
    CREATED_ON, CREATED_BY, MODIFIED_ON, MODIFIED_BY
FROM #OWNER#.IT_PROJECTS
WHERE PROJECT_ID = :P3_PROJECT_ID

Click Create Region.

On edit page for Page 3 under Regions, click on Audit Information.

Scroll down to Conditional Display and select Value of Item in Expression 1 is NOT NULL.

For Expression 1, enter P3_PROJECT_ID.

Click on Report Attributes tab at the top.

Under Layout and Pagination, make these changes:

Report Template - Select default: vertical report, look 1 (include null columns)

Pagination Scheme - Select - No Pagination Selected -

Enable partial Page Refresh - Select No

Accept all other defaults and click Apply Changes.

Create a Validation

The Form on a Table with Report Wizard created not null validations for Name, Start Date, and End Date. You must manually create another validation to ensure that the Actual End Date is the same or later then the Start Date.

To add a validation for the Actual End Date:

Under Page Processing, Validations, click the Create icon.

For Level, accept the default, Item level validation, and click Next.

For Item, select Project Details: 50.P3_ACTUAL_END_DATE (Actual End Date) and click Next.

For Validation Method:

Select PL/SQL and click Next.

Accept the default, PL/SQL Expression and click Next.

For Sequence and Name:

Sequence - Enter 50.

Validation Name - Enter P3_END_AFTER_START.

Accept the remaining defaults and click Next.

For Validation:

Validation - Enter:

to_date(:P3_ACTUAL_END_DATE,:APP_DATE_FORMAT) >= to_date
    (:P3_START_DATE,:APP_DATE_FORMAT)

Error Message - Enter:

Actual End Date must be same or after Start Date.

Click Next.

For Conditions:

Condition Type - Select Value of Item in Expression 1 is NOT NULL

Expression 1 - Enter P3_ACTUAL_END_DATE

Click Create.

Run Project Page and Project Details Page

To view the new Project page and Project Details page, click the Run Page icon in the upper right of the page.

Click the Application home breadcrumb.

Click the Run Application icon. The Issue Tracker home page appears along with a list of image links, as shown in Figure 15-10.

Figure 15-10 Issue Tracker Home Page

Description of Figure 15-10 follows
Description of "Figure 15-10 Issue Tracker Home Page"

Click the Projects link under the second image. The Project page should look similar to Figure 15-11.

Figure 15-11 Projects Page

Description of Figure 15-11 follows
Description of "Figure 15-11 Projects Page"

Click the edit icon next to the Email Integration project and click the + sign next to Audit Information to show details. The displayed Project Details page should look like Figure 15-12.

Figure 15-12 Project Details for Email Integration Project

Description of Figure 15-12 follows
Description of "Figure 15-12 Project Details for Email Integration Project"

Note:

In Figure 15-12, "Project Details for Email Integration Project", the Audit region is shown because the Project Name field is not empty. The Audit Information region has been expanded.

Add Pages to Track Users

Once the initial projects pages are complete, you create pages for maintaining users. To accomplish this, you use the Form on a Table with Report Wizard. This wizard creates a report page and a form page for the IT_PEOPLE table.

Topics in this section include:

Overview of User Pages

Create Pages for Maintaining Users

Modify Appearance of the Users Page

Refine the Appearance of the User Information Page

Run Users Page and User Information Page

Note:

If you are already familiar with this application, skip Overview of User Pages and proceed to "Create Pages for Maintaining Users".

Overview of User Pages

After completing this section, you will have a Users page and a Users Information page as shown in Figure 15-13, "Users Page" and Figure 15-14, "User Information Page for George Hurst".

You will be able to navigate to the User page by clicking the User link on the Home page. From the User page, you display the User Information page by clicking the Edit icon or the Add User button on the User page.

Figure 15-13 Users Page

Description of Figure 15-13 follows
Description of "Figure 15-13 Users Page"

Figure 15-14 User Information Page for George Hurst

Description of Figure 15-14 follows
Description of "Figure 15-14 User Information Page for George Hurst"

Users Page (4 - Users)

This page is a report of all users with access to the application. Components included on this page are described as follows:

Person Name: The name of the user.

Person Email: The users email address.

Person Role: The role of this person. In later sections, each role is given a different level of access to the application.

Username: The person's username to access this application.

Assigned Project: The project assigned to this person.

Search region: A filtered report can be obtained by selecting search criteria and clicking the Go button.

Edit icon: To edit user information, click on the edit icon to the left of the person's name. The user Information page is displayed showing the selected user's information.

Add User button: A new user can be provisioned for this application by clicking this button. An empty User Information page is displayed for you to enter specific user details.

User Information Page (5 - User Information)

This is a form that allows you to edit existing user information, and add a new user. When you click the Add user button or an edit icon on the Users page this information page is shown. Components included on this page are described as follows:

Cancel: Returns you to the Users page without submitting any unapplied changes.

Delete: Removes the user from the database after getting an OK response from a delete confirmation message. This button is displayed when a user is being edited and is not displayed when adding a user.

Apply Changes: Commits any user changes to the database. This button is displayed when a user is being edited and is not displayed when adding a user.

Create: Adds the user to the database. This button is displayed when a user is being added and is not displayed when editing a user.

User Information: This region allows you to enter user details.

Audit Report: When this region is expanded, the user audit information is displayed. Audit information cannot be edited. It is automatically updated for this user when the user is added or user information is edited.

Create Pages for Maintaining Users

To create pages for maintaining the IT_PEOPLE table:

Click Application breadcrumb.

Click Create Page.

Select Form and click Next.

Select Form on a Table with Report and click Next.

For Table/View Owner, select the appropriate schema and click Next.

For Table/View Name, select IT_PEOPLE and click Next.

For Define Report Page:

Implementation - Select Interactive.

Page Number - Enter 4

Page Name - Enter Users.

Region Title - Enter Users.

Region Template - Select No Template.

Breadcrumb - Select Breadcrumb.

Create Breadcrumb Entry section appears.

Entry Name - Users.

Parent Entry - Select Home link.

Accept the remaining defaults and click Next.

For Tab Options, select Use an existing tab set and create a new tab within the existing tab set.

For Tab Set, select Issue Tracker.

For New Tab Label, enter Users and click Next.

For Select Column(s), select PERSON_ID, PERSON_NAME, PERSON_EMAIL, PERSON_ROLE, USERNAME, ASSIGNED_PROJECT, and click Next.

For Edit Link Image, select the first option, and click Next.

For Define Form Page under Create Form Page:

Page - Enter 5.

Page Name and Region Title - Enter User Information.

Entry Name - Enter User Information.

For Define Form Page under Create Breadcrumb Entry:

Entry Name - Enter User Information.

Click Next.

For Primary Key, accept the default, PERSON_ID and click Next.

For Define the source for the primary key columns, accept the default, Existing Trigger, and click Next.

For Select Column(s), select PERSON_NAME, PERSON_EMAIL, PERSON_ROLE, USERNAME, ASSIGNED_PROJECT, and click Next.

For Insert, Update and Delete, accept the defaults and click Next.

Review your selections and click Finish.

Run the Page

To preview your page, click Run Page. As shown in Figure 15-15, notice the newly created report displays the demo data.

Figure 15-15 Users Page

Description of Figure 15-15 follows
Description of "Figure 15-15 Users Page"

To preview the page for adding or editing users, click the Edit icon in the far left column. The User Information page is displayed as shown in Figure 15-16, "User Information Page".

Figure 15-16 User Information Page

Description of Figure 15-16 follows
Description of "Figure 15-16 User Information Page"

Modify Appearance of the Users Page

Next, you alter the Users Information by following these steps.

Go to the Page Definition for page 4, Users:

Click Application on the Developer toolbar.

On the Application home page, click 4 - Users.

Under Regions, click Interactive Report next to Users.

For PERSON_ID, select Hidden for Display Text As.

At the top of the page, click Apply Changes.

Modify Name of Create Button

To change Create button to Add User> button:

On edit page for Page 4, under Buttons, select Create button.

Change Text Label/Alt from Create to Add User >, select Apply Changes.

Click the Run Page icon.

To reorder columns on the Users page:

On the running Users page, click the Action icon as shown in Figure 15-17.

Figure 15-17 Action Icon

Description of Figure 15-17 follows
Description of "Figure 15-17 Action Icon"

Select Select Columns.

Use the up and down arrows to the side of the Display in Report box to order columns how ever you wish.

Click Apply. The Users page appears with columns reordered according to your changes.

Change the Query to Include Project Name from IT_PROJECTS

To change the query to include a join to the Projects table:

Go to the Page Definition for page 4 - Users:

If you are viewing a running form, click Application on the Developer toolbar.

On the Application home page, click 4 - Users.

Under Regions, click Users.

Scroll down to Source.

In Region Source, replace the existing query with the following:

SELECT "IT_PEOPLE"."PERSON_ID" as "PERSON_ID",
    "IT_PEOPLE"."PERSON_NAME" as "PERSON_NAME",
    "IT_PEOPLE"."PERSON_EMAIL" as "PERSON_EMAIL",
    "IT_PEOPLE"."PERSON_ROLE" as "PERSON_ROLE",
    "IT_PEOPLE"."USERNAME" as "USERNAME",
    "IT_PROJECTS"."PROJECT_NAME" as "ASSIGNED_PROJECT"
FROM "#OWNER#"."IT_PEOPLE" "IT_PEOPLE",
    "#OWNER#"."IT_PROJECTS" "IT_PROJECTS"
WHERE "IT_PEOPLE"."ASSIGNED_PROJECT"="IT_PROJECTS"."PROJECT_ID" (+)

Note that the outer join is necessary because the project assignment is optional.

Click Apply Changes.

For Confirm Interactive Report Region Change, click Apply Changes.

Run the Page

To view your changes, click the Run Page icon in the upper right of the page. As shown in Figure 15-18, you may need to run the application as a developer to show and reorder some of the columns to look like the figure.

Figure 15-18 Revised Users Page

Description of Figure 15-18 follows
Description of "Figure 15-18 Revised Users Page"

Refine the Appearance of the User Information Page

Next, you customize the User Information page by adding lists of values to make it easier for users to select a Role or Assigned Project.

Add a List of Values for Projects

To add a list of values for Projects:

Go to the Page Definition for page 5, User Information:

If you are viewing a form, click Application on the Developer toolbar.

On the Application home page, click 5 - User Information.

Under Shared Components, locate the Lists of Values section and click the Create icon.

For Source, accept the default, From Scratch, and click Next.

For Name and Type:

Name - Enter PROJECTS.

Type - Select Dynamic.

Click Next.

In Query, replace the existing statements with the following:

SELECT project_name d, project_id r
FROM it_projects
ORDER BY d

Click Create List of Values.

Add a List of Values for Roles

To add a list of values for Roles:

Under Shared Components, locate the Lists of Values section and click the Create icon.

For Source, accept the default, From Scratch, and click Next.

For Name and Type:

Name - Enter ROLES.

Type - Select Static

Click Next.

Enter the display value and return value pairs shown in Table 15-2:

Table 15-2 Display Value and Return Value pairs

Display Value | Return Value
CEO | CEO
Manager | Manager
Lead | Lead
Member | Member

Click Create List of Values.

Edit Display Attributes

To edit display attributes for P5_PERSON_ROLE:

Click Edit Page icon for page 5.

Under Items, click P5_PERSON_ROLE.

From the Display As list in the Name section, select Radiogroup.

Scroll down to Label.

Change Label to Role.

Under Element, enter the following in Form Element Option Attributes:

class="instructiontext"

This specifies that the text associated with each radio group option is the same size as other items on the page.

Scroll down to List of Values.

From the Named LOV list, select ROLES.

Click Apply Changes.

To edit display attributes for P5_ASSIGNED_PROJECT:

Under Items, click P5_ASSIGNED_PROJECT.

From the Display As list in the Name section, select Select List.

Scroll down to List of Values.

Under List of Values:

From the Named LOV list, select PROJECTS.

For Display Null, select Yes.

For Null display value, enter:

- None -

Click Apply Changes.

To alter the display of fields and field labels:

Under Items, click the Edit All icon.

For P5_PERSON_NAME:

Prompt - Enter Name.

Width - Enter 60.

For P5_PERSON_EMAIL:

Prompt - Enter Email Address.

For Width, enter 60.

For P5_USERNAME:

Sequence - Enter 35.

Width - Enter 60.

For P5_PERSON_ROLE:

Width - Enter 7.

For P5_ASSIGNED_PROJECT, enter 50 for Sequence.

Click Apply Changes.

Click the Edit Page icon in the upper right corner to return to the Page Definition for Page 5.

Add Audit Report

To add an Audit Report region at the bottom of the User Information:

On edit page for Page 5, under Regions, select Create icon.

Select Report and click Next.

Select SQL Report and click Next.

For Create Region, make these changes:

Title - Enter Audit Report.

Region Template - Select Hide and Show Region.

Click Next.

For Enter SQL Query or PL/SQL function returning SQL Query, enter:

SELECT  CREATED_ON, CREATED_BY,
    MODIFIED_ON, MODIFIED_BY
FROM  IT_PEOPLE
WHERE PERSON_ID = :P5_PERSON_ID

Click Create Region.

Under Regions, click Report next to Audit Report.

Under Layout and Pagination, make these changes:

Report Template - Select default: vertical report, look 1 (include null columns).

Pagination Scheme - Select - No Pagination Selected -

Enable Partial Page Refresh - Select No.

Number of Rows - Enter 15.

Maximum Row Count - Enter 500.

Click Apply Changes.

Create a Validation

The Form on a Table with Report Wizard created not null validations for Name, Email, Role and Username. You must manually create another validation to ensure that Leads and Members have an assigned project while the CEO and Managers do not. As a best practice, it is generally best to use built-in validation types because they are faster. However, for this compound type of validation, you will write a PL/SQL validation.

To add validations to ensure the correct people are assigned projects:

Under Page Processing, Validations, click the Create icon.

For Level, accept the default, Item level validation, and click Next.

For Item, select User Information: 50. P5_ASSIGNED_PROJECT (Assigned Project) and click Next.

For Validation Method:

Select PL/SQL and click Next.

Accept the default, PL/SQL Expression and click Next.

For Sequence and Name:

Sequence - Enter 60.

Validation Name - Enter PROJECT_MAND_FOR_LEADER_AND_MEMBER.

Accept the remaining defaults and click Next.

For Validation:

Validation - Enter:

(:P5_PERSON_ROLE IN ('CEO','Manager') AND
:P5_ASSIGNED_PROJECT = '%'||'null%') OR
(:P5_PERSON_ROLE IN ('Lead','Member') AND
:P5_ASSIGNED_PROJECT != '%'||'null%')

Oracle Application Express passes nulls as %null%. It also replaces %null% with a null when it processes data. Therefore, to keep it in the validation, you need to break the string apart so that it is not recognized and replaced.

Error Message - Enter:

Leads and Members must have an Assigned Project. CEO and Managers cannot have an Assigned Project.

Click Next.

Click Create.

Run Users Page and User Information Page

To view the new Users page and User Information page, click the Run Page icon in the upper right of the page.

Click on the application home breadcrumb. You should see the pages created so far in this tutorial, including the Users and User Information pages.

Click on the Run Application icon. The Home page contains a list of image links as shown in Figure 15-19.

Figure 15-19

Description of Figure 15-19 follows
Description of "Figure 15-19 "

Click the Users link to the far right. The Users page will be displayed and will look similar to Figure 15-20, "Users Page".

Figure 15-20 Users Page

Description of Figure 15-20 follows
Description of "Figure 15-20 Users Page"

Click the Edit icon to the left of Carla Downing. You will see the User page displayed similar to the one in Figure 15-21.

Figure 15-21 User Information for Carla Downing

Description of Figure 15-21 follows
Description of "Figure 15-21 User Information for Carla Downing"

Now test the validation process that ensures users with a Lead or Member role have an assigned project.

For Assigned Project, select - None -, and click Apply Changes. The User Information page is displayed with an error message.

Next, add a new user to the Issue Tracker Application.

Click the Users breadcrumb to go back to Users page.

Click the Add User> button. As shown in Figure 15-22, "Add User Page", an empty User Information form is displayed.

Figure 15-22 Add User Page

Description of Figure 15-22 follows
Description of "Figure 15-22 Add User Page"

Enter the new user's Name, Email Address, Username and select a Role. Do not assign a project unless the role is Lead or Member.

Note:

The validation process will make sure a CEO or Manager does not have a project assigned, and will ensure that a Lead or Member does have a project assigned. To test the validation process, violate one of these conditions and click Create. An error message will appear.

Click Create. The Users page is displayed with the newly added user listed.

Add Pages to Track Issues

Now you need to create pages to retrieve issue information from IT_ISSUES.

Topics in this section include:

Overview of Issues Pages

Create a Report for Issues

Refine the Issue Details

Refine the Issues Report

Run Issues Page and Issue Details Page

Note:

If you are already familiar with this application, skip Overview of Issues Pages and proceed to "Create a Report for Issues".

Overview of Issues Pages

This application needs multiple views on Issues. You can create these views as single reports or as separate reports. For this exercise, you create a complex report that includes an Issues maintenance form. You then link this maintenance form in multiple places. Ultimately, the Issues report will display Issues by the person who identified the issue, project, assigned person, status, or priority.

Upon completion of this section, the application will have an Issues page, and Issues Details page as shown in Figure 15-23, "Issues Page" and Figure 15-24, "Issue Details".

Figure 15-23 Issues Page

Description of Figure 15-23 follows
Description of "Figure 15-23 Issues Page"

Figure 15-24 Issue Details

Description of Figure 15-24 follows
Description of "Figure 15-24 Issue Details"

Issues Page (6 - Issues)

This page reports issues that have been entered into the system along with general issue information. Components included on this page are described as follows:

Issue Summary: Short description of the issue.

Identified Date: The date the issue occurred.

Status: The issue status which can be open, closed or on-hold.

Priority: The issue priority which can be high, medium or low.

Target Resolution Date: The date this issue should be closed.

Progress: A brief description of progress made for this issue.

Actual Resolution Date: The date the issue was closed.

Identified By: The person who encountered the issue.

Project Name: The project this issue falls under. The project is a list of values already specified in the system.

Assigned To: The person assigned to resolve this issue. The person must be a user already entered into the system.

Search region: A filtered report can be obtained by selecting search criteria and clicking the Go button.

Edit icon: To edit user information, click on the edit icon to the left of the person's name. The user Information page is displayed showing the selected user's information.

Add Issue button: A new issue can be added by clicking this button. An empty Issue Details page appears for you to enter specific issue details.

Issue Details Page (7 - Issue Details)

This form allows you to edit existing issue information, and add a new issue. When you click the Add Issue button or an edit icon on the Issues page this details page is shown. Components included on this page are described as follows:

Cancel: Returns you to the Issues page without submitting any unapplied changes.

Delete: Removes the issues from the database after getting an OK response from a delete confirmation message. This button is displayed when an issue is being edited and is not displayed when adding an issue.

Apply Changes: Commits any issue changes to the database. This button is displayed when an issue is being edited and is not displayed when adding an issue.

Create: Adds the issue to the database. This button is not displayed when an issue is being edited and is displayed when adding an issue.

Issue Details: This region allows you to enter specific issue information.

Audit Report: When this region is expanded, the issue audit information is displayed. Audit information cannot be edited. It is automatically updated for this issue when the issue is added or issue details are edited.

Create a Report for Issues

To create a report for maintaining IT_ISSUES:

Click Application on the Developer toolbar.

Click Create Page.

Select Form and click Next.

Select Form on a Table with Report and click Next.

For Table/View Owner, select the appropriate schema and click Next.

For Table/View Name, select IT_ISSUES and click Next.

On Define Report Page:

Implementation - Interactive.

Page Number - Enter 6.

Page Name - Enter Issues.

Region Title - Enter Issue.

Region Template - Select No Template.

Breadcrumb - Select Breadcrumb.

Create Breadcrumb Entry section appears.

Entry Name - Issues.

Select Parent Entry - Select Home link.

Accept the remaining defaults and click Next.

For Define Report Page tab settings, make these changes:

Tab Options - Select Use an existing tab set and create a new tab within the existing tab set.

Tab Set - Select Issue Tracker.

New Tab Label - Enter Issues.

Click Next.

For Tab Set, select Issue Tracker and click Next.

For New Tab Label, enter Issues and click Next.

For Select Column(s), press CTRL and select these columns:

ISSUE_ID

ISSUE_SUMMARY

IDENTIFIED_BY_PERSON_ID

IDENTIFIED_DATE

RELATED_PROJECT_ID

ASSIGNED_TO_PERSON_ID

STATUS

PRIORITY

TARGET_RESOLUTION_DATE

PROGRESS

ACTUAL_RESOLUTION_DATE

Click Next.

For Edit Link Image, select the first option and click Next.

On Define Form Page:

Page Number - Enter 7.

Page Name - Enter Issue Details.

Region Title - Enter Issue Details.

Region Template - Select Form Region.

Under Create Breadcrumb entry for Entry Name - Enter Issue Details.

Click Next.

For Primary Key, accept the default, ISSUE_ID, and click Next.

For Define the source for the primary key columns, accept the default, Existing Trigger, and click Next.

For Select Column(s), select all columns except for CREATED_ON, CREATED_BY, MODIFIED_ON, and MODIFIED_BY and click Next.

The CREATED_ON, CREATED_BY, MODIFIED_ON, and MODIFIED_BY columns are added to page 7, Issue Details, in subsequent steps when the Audit region is created.

For Insert, Update and Delete, accept the default value, Yes, and click Next.

Review your selections and click Finish.

Click Edit Page.

Refine the Issue Details

The appearance of this page needs to be modified to look like Figure 15-24, "Issue Details". You need to modify how the columns and fields are displayed, reorganize the page into regions of similar information and add a button to create new issues sequentially.

Add Lists of Values

Edit Specific Items

Create Regions to Group Items

Move Items to the Appropriate Regions

Change the Display of Audit Columns

Return the User to the Calling Page

Add Functionality to Support Adding Multiple Issues Sequentially

Run the Page

Add Lists of Values

Next, you need to add lists of values for Status, Priorities, and People. To add a list of values for Status:

Go to the Page Definition for page 7, Issue Details.

Under Shared Components, Lists of Values, click the Create icon.

For Create List of Values, accept the default, From Scratch, and click Next.

On Create List of Values, make these changes:

Name - Enter STATUS.

For Type, select Static.

Click Next.

Enter the Display Value and Return Value pairs shown in Table 15-3:

Table 15-3 Display Value and Return Value Pairs

Display Value | Return Value
Open | Open
On-Hold | On-Hold
Closed | Closed

Click Create List of Values.

To add a list of values for Priorities:

On the Lists of Values page, click Create.

For Create List of Values, accept the default, From Scratch, and click Next.

On Create List of Values, make these changes:

Name - Enter PRIORITIES.

Type - Select Static.

Click Next.

Enter the Display Value and Return Value pairs shown in Table 15-4.

Table 15-4 Display Value and Return Value Pairs

Display Value | Return Value
High | High
Medium | Medium
Low | Low

Click Create List of Values.

To add a list of values for People:

On the Lists of Values page, click Create.

For Create List of Values, accept the default, From Scratch, and click Next.

On Create List of Values, make these changes:

Name - Enter PEOPLE.

Type - Select Dynamic.

Click Next.

In Query, replace the existing statements with the following:

SELECT person_name d, person_id r
   FROM it_people
ORDER BY 1

Click Create List of Values.

Go to the Page Definition for page 7.

Edit Specific Items

Next, you edit individual items. To edit P7_IDENTIFIED_BY_PERSON_ID:

Under Items on the Page Definition for Page 7, click P7_IDENTIFIED_BY_PERSON_ID.

For Name, enter P7_IDENTIFIED_BY.

From the Display As list in the Name section, select Select List.

Under Label and for Label, enter Identified By.

Under List of Values, make these changes:

Named LOV - Select PEOPLE.

Display Null - Select Yes. The base column is mandatory, but you do not want the first name in the list becoming the default value.

Null display value - Enter:

 - Select Person -

Click the Next button (>) at the top of the page to go to the next item, P7_IDENTIFIED_DATE.

The Edit Page Item page appears.

To edit P7_IDENTIFIED_DATE:

Scroll down to Default:

Default value - Enter:

to_char(sysdate,:APP_DATE_FORMAT);

Default Value Type - Select PL/SQL Expression.

Click the Next button (>) at the top of the page to go to the next item, P7_RELATED_PROJECT_ID.

The Edit Page Item page appears.

To edit P7_RELATED_PROJECT_ID:

For Name, enter P7_RELATED_PROJECT.

From the Display As list in the Name section, select Select List.

For Label, enter Related Project.

Scroll down to List of Values. For List of Values:

Named LOV - Select PROJECTS.

Display Null- Select Yes.

Null display value - Enter:

 - Select Project -

Click the Next button (>) at the top of the page until you go to P7_ASSIGNED_TO_PERSON_ID.

To edit P7_ASSIGNED_TO_PERSON_ID:

For Name, enter P7_ASSIGNED_TO.

From the Display As list in the Name section, select Select List.

For Label, enter Assigned To.

Scroll down to List of Values. For List of Values:

Named LOV - Select PEOPLE.

Display Null- Select Yes.

Null display value - Enter:

 - Select -

Click the Next button (>) at the top of the page until you go to P7_STATUS.

To edit P7_STATUS:

From the Display As list in the Name section, select Radiogroup.

Under Label, enter the following in the Label field:

Status:

Under Element, enter the following in the Form Element Option Attributes field:

class="instructiontext"

Under Default, enter Open in Default value.

Under List of Values:

Named LOV - Select STATUS.

Number of Columns - Enter 3.

This selection reflects the fact there are three valid values.

Click the Next button (>) at the top of the page to go to P7_PRIORITY.

To edit P7_PRIORITY:

From the Display As list in the Name section, select Radiogroup.

Under Label, enter the following in the Label field:

Priority:

Under Element, enter the following in the Form Element Option Attributes field:

class="instructiontext"

Under Default, enter Low in Default value.

Under List of Values:

Named LOV - Select PRIORITIES.

Number of Columns - Enter 3.

This selection reflects the fact there are three valid values.

Click Apply Changes.

Modify Validations to Match Item Name Changes

To edit validations:

On the edit page for page 7, under Validations, select P7_IDENTIFIED_BY_PERSON_ID not null.

For Name, enter P7_IDENTIFIED_BY not null.

For Validation Expression 1, enter P7_IDENTIFIED_BY.

Scroll down to Error Message.

For Error Message, enter:

Identified By must have some value.

Click Next icon (>) at the top of the page until edit page for P7_RELATED_PROJECT_ID not null is displayed.

For Name, enter P7_RELATED_PROJECT not null.

For Validation Expression 1, enter P7_RELATED_PROJECT.

Scroll down to Error Message.

For Error Message, enter:

Related Project must have some value.

Click Apply Changes.

Click Run icon for page 7. The Issue Details page is displayed and should look similar to Figure 15-25.

Figure 15-25 Issue Details before Grouping Items

Description of Figure 15-25 follows
Description of "Figure 15-25 Issue Details before Grouping Items"

Create Regions to Group Items

Currently all items are grouped into one large region. Displaying items in logical groups makes data entry easier for users. Therefore, you next create four new regions named Buttons, Progress, Resolution, and Audit Information. You also rename an existing region.

To create new regions to group items:

Click the Edit Page 7 link at the bottom of the page.

Under Regions, click the Create icon.

Select Multiple HTML and click Next.

For the first row:

For Sequence, enter 15.

For Title, enter Progress.

For Template, select Form Region.

For the second row:

For Sequence, enter 20.

For Title, enter Resolution.

For Template, select Form Region.

Click Create Region(s).

Under Regions, click the Create icon.

Select Report and click Next.

Select SQL Report and click Next.

For Title, enter Audit Information:

For Title, enter Audit Information.

For Region Template, select Hide and Show Region.

For Sequence, enter 40.

Click Next.

For Enter SQL Query or PL/SQL function returning a SQL Query, enter:

select     "IT_ISSUES"."CREATED_ON" as "CREATED_ON",
         "IT_ISSUES"."CREATED_BY" as "CREATED_BY",
         "IT_ISSUES"."MODIFIED_ON" as "MODIFIED_ON",
         "IT_ISSUES"."MODIFIED_BY" as "MODIFIED_BY"
 from    "IT_ISSUES" "IT_ISSUES"
 where   ISSUE_ID = :P7_ISSUE_ID

Click Create Region.

Click Report next Audit Information region.

Under Layout and Pagination, make these changes:

Report Template - Select default: vertical report, look 1 (include null columns).

Pagination Scheme - Select - No Pagination Selected -

Enable Partial Page Refresh - Select No.

Number of Rows - Enter 15.

Maximum Row Count - Enter 500.

Click Apply Changes.

Move Items to the Appropriate Regions

Next, move each item to the appropriate region. Note that you also need to modify some item widths.

To move items to the appropriate regions:

Under Items, click the Edit All icon.

The Page Items summary page appears.

Under Region, select Progress for the following items:

P7_ASSIGNED_TO

P7_STATUS

P7_PRIORITY

P7_TARGET_RESOLUTION_DATE

P7_PROGRESS

Under Region, select Resolution for the following items:

P7_ACTUAL_RESOLUTION_DATE

P7_RESOLUTION_SUMMARY

Under Width, make the following edits:

For P7_ISSUE_SUMMARY, enter 80.

For P7_ISSUE_DESCRIPTION, enter 80.

For P7_IDENTIFIED_DATE, enter 12.

For P7_TARGET_RESOLUTION_DATE, enter 12.

For P7_PROGRESS, enter 80.

For P7_ACTUAL_RESOLUTION_DATE, enter 12.

For P7_RESOLUTION_SUMMARY, enter 80.

Under Sequence, make the following edits:

For P7_ISSUE_ID, enter 168.

For P7_ISSUE_SUMMARY, enter 169.

For P7_ISSUE_DESCRIPTION, enter 170.

For P7_IDENTIFIED_BY, enter 173.

For P7_IDENTIFIED_DATE, enter 174.

For P7_RELATED_PROJECT, enter 172.

For P7_ASSIGNED_TO, enter 159.

For P7_STATUS, enter 160.

For P7_PRIORITY, enter 161.

For P7_TARGET_RESOLUTION_DATE, enter 162.

For P7_PROGRESS, enter 164.

For P7_ACTUAL_RESOLTUTION_DATE, enter 165.

For P7_RESOLUTION_SUMMARY, enter 167.

Click Apply Changes.

Click Run icon for page 7. The Issue Details page is displayed and should look similar to Figure 15-26.

Figure 15-26 Issue Details after Grouping Items

Description of Figure 15-26 follows
Description of "Figure 15-26 Issue Details after Grouping Items"

Change the Display of Issues Details, Progress and Resolution Regions

To modify how these columns display:

Click the Edit Page 7 link at the bottom of the page.

Under Items, click P7_ISSUE_SUMMARY.

For Display As, select Textarea.

Under Label, for Horizontal/Vertical Alignment, select Above.

Under Element, make these changes:

Maximum Width - Enter 200

Height - Enter 2.

Select Next icon at top of page to display P7_ISSUE_DESCRIPTION edit page item.

Under Label, for Horizontal/Vertical Alignment, select Above.

Under Element, make these changes:

Maximum Width - Enter 2000.

Height - Enter 4.

Click Apply Changes.

Under Items, click P7_PROGRESS.

Under Label, for Horizontal/Vertical Alignment, select Above.

Under Element, enter 2000 for Maximum Width.

Click Apply Changes.

Under items, click P7_RESOLUTION_SUMMARY.

Under Label, for Horizontal/Vertical Alignment, select Above.

Under Element, enter 2000 for Maximum Width.

Click Apply Changes.

Click Run Page 7 icon at top of page. The Issue Details page shows the Issue Summary, Issue Description and Progress labels above the text area as shown in Figure 15-27.

Figure 15-27 Issue Details with Labels Above Text Areas

Description of Figure 15-27 follows
Description of "Figure 15-27 Issue Details with Labels Above Text Areas"

Now, add a Stop and Start HTML Table item to each region. This will realign all items in the region to be left justified.

Click the Edit Page 7 link from the developer toolbar.

Under Items, click the Create icon

Select Stop and start table and click Next.

To realign Related Project, Identified By and Identified Date make these changes for Display and Position Name:

Item_Name - Enter P7_3_0.

Sequence - Enter 171.

Region - Select Issues Identification (1) 10.

Click Create Item.

Under Items, click the Create icon.

Select Stop and start table and click Next.

To realign Assigned To, Status, Priority, and Target Resolution Date make these changes for Display and Position Name:

Item_Name - Enter P7_4_0.

Sequence - Enter 163.

Region - Select Progress (1) 15.

Click Create Item.

Under Items, click the Create icon.

Select Stop and start table and click Next.

To realign Actual Resolution Date make these changes for Display and Position Name:

Item_Name - Enter P7_1_0.

Sequence - Enter 166.

Region - Select Resolution (1) 20.

Click Create Item.

Click Run Page 7 icon. the Issues Details page now has all the items aligned properly as shown in

Figure 15-28 Issue Details After Realignment

Description of Figure 15-28 follows
Description of "Figure 15-28 Issue Details After Realignment"

Change the Display of Audit Columns

Because the Audit columns should be viewable but not editable, you need to make them display only. In the following exercise, you create a condition for the Audit Information region. As a result, the Audit Information region displays when a user edits an existing issue, but does not appear when a user creates a new issue.

To create a condition for the Audit Information region.

Click Edit Page 7 link at bottom of page.

Under Regions, click Audit Information.

Scroll down to Conditional Display.

From Condition Type, select Value of Item in Expression 1 is NOT NULL.

In Expression 1, enter the following:

P7_ISSUE_ID

Click Apply Changes

Return the User to the Calling Page

Because this Issue Details page will be called from several places, when users finish with the display, they should return to the calling page. To accomplish this, you create an item and change the branch on the Issue Details page. Every time the Issue Details page is called, the item must be set with the number of the calling page.

To create a hidden item:

Under Items, click the Create icon.

For Select Item Type, select Hidden and click Next.

For Hidden Item Type, select Hidden and click Next.

For Display Position and Name:

Item Name - Enter:

P7_PREV_PAGE

Sequence - Enter 175.

Region - Select Issue Details

Click Next.

For Default, enter 1.

Click Create Item.

The Page Definition for page 7 appears.

Next, edit the Cancel button to return to the page number stored in P7_PREV_PAGE.

To edit the Cancel button:

Under Buttons, click Cancel.

Scroll down to Optional URL Redirect.

In Page, enter:

&P7_PREV_PAGE.

Note the period at the end.

Select reset pagination for this page.

Click Apply Changes.

To edit the branch:

Under Branches, select the After Processing branch, Go to Page 6 Unconditional.

Under Action, make these changes:

Select reset pagination for this page

Deselect include process success message

For Clear Cache - Enter 7

For Set these items - Enter P7_PREV_PAGE

Click Apply Changes.

Add Functionality to Support Adding Multiple Issues Sequentially

Next, you add functionality that enables users to add more than one issue at a time. To accomplish this, you first add a new button and then create a new branch.

To add a new button:

Under Buttons, click the Copy button icon between the Edit All and Create icons at the top right of the Buttons section. The Copy icon looks like Figure 15-29.

Figure 15-29 Copy Button Icon

Description of Figure 15-29 follows
Description of "Figure 15-29 Copy Button Icon"

For Button to copy, click CREATE.

For Target Page, accept the default, 7, and click Next.

For New Button:

Button Name - Enter CREATE_AGAIN.

Label - Enter Create and Create Another.

Accept remaining defaults and click Copy Button.

Next, create a branch that keeps the user on the Create page.

Note that this branch also resets P7_PREV_PAGE because the value of that item will be lost when the cache of the page is cleared. The sequence of this new branch will be 0. Setting the sequence to 0 makes the branch fire before the default branch but only when the Create and Create Another button is used.

To create a branch that keeps the user on the create page:

Under Page Processing, Branches, click the Create icon.

For Point and Type, accept the defaults and click Next.

For Target, make these changes:

Page - Enter 7.

Select reset pagination for this page

Clear Cache - Enter 7.

Set these items - Enter the following:

P7_PREV_PAGE

With these values - Enter the following (be sure to include the period):

&P7_PREV_PAGE.

Click Next.

For Branch Conditions, make these changes:

Sequence - Enter 0.

When Button Pressed - Select CREATE_AGAIN (Create and Create Another).

Click Create Branch.

Run the Page

To see the changes, click the Run Page icon. The new form appears as shown in Figure 15-30, "Refined Issue Details".

Figure 15-30 Refined Issue Details

Description of Figure 15-30 follows
Description of "Figure 15-30 Refined Issue Details"

The branch you just created is looking for a value in P7_PREV_PAGE. Since the page was not called from another page, the value has not been set. You need to fix that next.

Refine the Issues Report

Next, you refine the Issues report page to support dynamic modification of the query. To accomplish this, you must:

Modify Add Issue Button

Change the Query and Display

Reorder Tabs

Modify Add Issue Button

To call Issue Details page from the Add Issue button:

Go to the Page Definition for page 6, Issues.

Under Button, click the Create button.

For Text Label/Alt, enter Add Issue>.

Under Optional URL Redirect, make these changes:

Set These Items - Enter P7_PREV_PAGE

With These Values - Enter 6.

Click Apply Changes.

Change the Query and Display

Next, change the query to display the actual values for people and projects instead of the ID and then clean up the report display.

To change the SQL query:

Under Regions, select Issues.

Scroll down to Source.

Replace SQL with the following:

SELECT "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",
    "IT_ISSUES"."ISSUE_ID" as "ISSUE_ID",
    "IT_ISSUES"."RELATED_PROJECT_ID" as "PROJECT_ID"
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.

Now to confirm, click Apply Changes.

To edit column attributes:

Under Regions, select Interactive Report.

For ISSUE_ID, Display Text As, select Hidden.

Click the Edit icon to the left of ISSUE_SUMMARY.

For Heading Alignment, select left.

Return to the top of the page and click the Next (>) icon. The Report Attributes page for IDENTIFIED_DATE appears.

For Heading Alignment, select left.

Return to the top of the page and click the Next (>) icon until the Report Attributes page for IDENTIFIED_BY appears.

For Heading Alignment, select left.

Return to the top of the page and click the Next (>) icon. The Report Attributes page for PROJECT_NAME appears.

For Heading Alignment, select left.

Return to the top of the page and click the Next (>) icon. The Column Attributes page for ASSIGNED_TO appears.

For Heading Alignment, select left.

Return to the top of the page and click the Next (>) icon. The Column Attributes page for PROJECT_ID appears.

For Display Text As, select Hidden.

Click Apply Changes.

To add a no data found message and to add details for a link column:

Scroll down to Pagination.

For When No Data Found Message, enter:

No issues found.

Scroll down to Link Column, for Item 2 Name, enter P7_PREV_PAGE.

For Item 2 Value, enter 6.

Click Apply Changes.

Reorder Tabs

Move the Issues tab so it is between the Projects and Users tab.

To change the tab order:

Click on the application home breadcrumb.

Click Shared Components.

Under Navigation, select Tabs.

Click Resequence display order link on the right panel under Standard Tab Tasks.

In the Sequence column, make these changes:

For Projects - Enter 15 for Sequence.

For Users - Enter 30 for Sequence.

For Issues - Enter 20 for Sequence.

Click Apply Changes.

Run Issues Page and Issue Details Page

To view the new Issues page and Issue Details page, click the Run Page icon in the upper right of the page.

Click on the application home breadcrumb. You should see the pages created so far in this tutorial, including the newly added Issues and Issue Details pages.

Click on the Run Application icon. The Home page contains a list of image links as shown in Figure 15-31.

Figure 15-31 Home Page

Description of Figure 15-31 follows
Description of "Figure 15-31 Home Page"

Click the Issues link. The Issues page is displayed. The first time you run this page, because you changed the names of some of the columns, you may not see the Identify By, Project Name and Assigned To columns. If this is the case, you can further customize the reports display by running the page and specifying which columns you want to appear.

To specify which columns to display:

On the running Issues page, click the Action menu drop down to the right of the Go button as shown in Figure 15-32

Figure 15-32 Action Icon

Description of Figure 15-32 follows
Description of "Figure 15-32 Action Icon"

Select Select Columns. Your page should look similar to Figure 15-33.

Figure 15-33 Adding Columns to an Interactive Report

Description of Figure 15-33 follows
Description of "Figure 15-33 Adding Columns to an Interactive Report"

Click the Move All icon (>>) between the Do Not Display list and the Display in Report list. The three missing columns will move to the Display in Report list.

Click Apply at the bottom right of the Select Columns area. Your Issues page should now look like Figure 15-34.

Figure 15-34 Issues Report with all Columns Displayed

Description of Figure 15-34 follows
Description of "Figure 15-34 Issues Report with all Columns Displayed"

Next, you view the Issue Details page for one of the issues.

Click the Edit icon to the left of one of the issues. You will see the Issue Details page displayed similar to the one in Figure 15-35.

Figure 15-35 Issue Details

Description of Figure 15-35 follows
Description of "Figure 15-35 Issue Details"

Click the Issues breadcrumb to go back to the Issues page.

Click the Add Issue> button. An empty Issue Details page should appear.

Add Pages for Summary Reports

Now it's time to add a Summary Reports page that links to the following individual reports:

Assign Open Issues Report

Issue Summary by Project Report

Resolved by Month Identified Report

Target Resolution Dates Report

Average Days to Resolve Report

Topics in this section include:

Overview of Summary Reports Pages

Add a Summary Reports Page

Add an Assign Open Issues Report Page

Add an Issue Summary by Project Report Page

Add Resolved by Month Identified Report Page

Add a Calendar to Display Target Resolution Dates

Add a Bar Chart to Display Average Days to Resolve

Note:

If you are already familiar with this application, skip Overview of Issues Pages and proceed to "Create a Report for Issues".

Overview of Summary Reports Pages

When you complete this exercise, you will have a Summary Reports page, that resembles Figure 15-36, "Summary Reports Page", and a separate report page for each individual summary report. Each image on the Summary Reports page links to a separate summary report as shown in Figure 15-37, "Issue Summary By Report and Assign Open Issues" and Figure 15-38, "Target Resolution Dates and Average Days to Resolve".

Figure 15-36 Summary Reports Page

Description of Figure 15-36 follows
Description of "Figure 15-36 Summary Reports Page"

Figure 15-37 Issue Summary By Report and Assign Open Issues

Description of Figure 15-37 follows
Description of "Figure 15-37 Issue Summary By Report and Assign Open Issues"

Figure 15-38 Target Resolution Dates and Average Days to Resolve

Description of Figure 15-38 follows
Description of "Figure 15-38 Target Resolution Dates and Average Days to Resolve"

Figure 15-39 Resolved by Month Identified

Description of Figure 15-39 follows
Description of "Figure 15-39 Resolved by Month Identified"

Add a Summary Reports Page

Before creating the Summary Reports Page, you need to create an Image List with an Image Entry for each report linked to from the Summary Reports Page.

Create an Image List

To create the Image List:

Click the Application home breadcrumb link.

Click Shared Components.

Under Navigation, click Lists.

Click Create.

For Name, enter Reports.

For List Template, select Horizontal Images with Label List.

Click Create.

Now, create a list of images.

Click Create List Entry >.

Under Entry, make these changes:

Sequence - Enter 10.

Image - Enter:

menu/address_book_bx_128x128.png

List Entry Label - Enter:

Issue Summary<br/>
by Project

Under Target, for Page, enter 9. This is the Issue Summary Report page that will be created later in this section.

Click Create and Create Another.

Under Entry, make these changes:

Sequence - Enter 15.

Image - Enter:

menu/eba_checklist_bx_128x128.png

List Entry Label - Enter:

Assign Open<br/>Issues

Under Target, for Page, enter 8. This is the Assign Open Issues page that will be created later in this section.

Click Create and Create Another.

Under Entry, make these changes:

Sequence - Enter 20.

Image - Enter:

menu/calendar_bx_128x128.png

List Entry Label - Enter:

Target Resolution<br/>Dates

Under Target, for Page, enter 11. This is the Target Resolution Dates page that will be created later in this section.

Click Create and Create Another.

Under Entry, make these changes:

Sequence - Enter 30.

Image - Enter:

menu/piechart_bx_128x128.png

List Entry Label - Enter:

Average Days<br/>to Resolve

Under Target, for Page, enter 12. This is the Average Days to Resolve page that will be created later in this section.

Click Create and Create Another.

Under Entry, make these changes:

Sequence - Enter 40.

Image - Enter:

menu/generate_bx_128x128.png

List Entry Label - Enter:

Issues Resolved<br/>by Month

Under Target, for Page, enter 10. This is the Issues Resolved By Month page that will be created later in this section.

Click Create.

Create the Reports Page

To add the Reports Page that references the Image List:

Click the application home breadcrumb.

Click Create Page.

Select Blank Page and click Next.

For Page Number, enter 14 click Next.

For Name, enter Reports.

For Breadcrumb, select Breadcrumb.

For Parent Entry, select Home.

Click Next.

Under Tabs, select Yes - Use an existing tab set and create a new tab within the existing tab set and click Next.

For Existing Tab Set, select Issue Tracker (Home, Projects, Issues...) and click Next.

For Tab Label, enter Reports and click Next.

Click Finish.

Click application home breadcrumb.

Click Shared Components.

Under Navigation, click Tabs.

Click Reports tab.

Click Edit icon.

For Sequence, enter 25 and click Apply Changes.

Click application home breadcrumb.

Click Reports page.

Under Regions, click Create button.

Select List and click Next.

For Title, enter Reports.

For Region Template, select No Template and click Next.

For List, select Reports.

Click Create List Region.

Run the Reports Page

Run Reports page 14 by clicking the run icon at the top of the edit page. As shown in Figure 15-40, the Reports page displays a list of images.

Figure 15-40 Reports Page After Adding List of Images

Description of Figure 15-40 follows
Description of "Figure 15-40 Reports Page After Adding List of Images"

Note:

Because not all the reports have been created at this point in the tutorial, the report links under each image will not work. As each report is created, these links will navigate to the appropriate report.

Add an Assign Open Issues Report Page

Currently, you can assign an issue by editing it on the Issues Details page. Next, you add a new page named Assign Open Issues, that enables users to assign multiple issues at once and modify the Related Project, Status, and Priority.

Create a Tabular Form

To add a new page to support assigning multiple issues:

Go to the Application home page.

Click Create Page.

Select Form and click Next.

Select Tabular Form and click Next.

For Table/View Owner:

Table/View Owner- Select the appropriate schema.

Allowed Operations - Select Update Only.

For this exercise, the purpose of this form is to enable users to assign issues, or update existing records, and not create or delete issues.

Click Next.

For Table/View Name, select IT_ISSUES and click Next.

For Displayed Columns:

Press CTRL and select the following columns:

ISSUE_SUMMARY

IDENTIFIED_BY_PERSON_ID

IDENTIFIED_DATE

RELATED_PROJECT_ID

ASSIGNED_TO_PERSON_ID

STATUS

PRIORITY

Click Next.

For Primary Key, accept the default, ISSUE_ID, and click Next.

For Primary Key Source, accept the default, Existing trigger, and click Next.

For Updatable Columns:

Press CTRL and select the following columns:

RELATED_PROJECT_ID

ASSIGNED_TO_PERSON_ID

STATUS

PRIORITY

Click Next.

For Page and Region Attributes:

Page - Enter 8.

Page Name - Enter Assign Open Issues.

Region Title - Enter Assign Issues.

Region Template - Select No Template.

Breadcrumb - Select Breadcrumb.

Entry Name - Enter Assign Open Issues

For Parent Entry, select Reports.

Click Next.

For Tab Options, select Use an existing tab set and reuse an existing tab within that tab set.

For Tab Set, select Issue Tracker (Home, Dashboard, Projects...).

Click Next.

For Use Tab, select T_REPORTS and click Next.

For Button Labels:

For Cancel Button Label, accept the default.

For Submit Button Label, enter Apply Changes.

Click Next.

For Branching, enter 14 for When Cancel Button Pressed Branch to this Page and click Next.

Review your selections and click Finish.

Add Lists of Values

Once you have created the initial tabular form, you need to add lists of values to make it easier to select issues. Additionally, you need to restrict the query to display only unassigned issues.

To add lists of values:

From the Success page, click Edit Page.

The Page Definition for page 8, Assign Open Issues, appears.

Under Regions, click Assign Issues.

Under Source, for Region Source, replace the existing statements with the following:

SELECT
    "ISSUE_ID",
    "ISSUE_SUMMARY",
    "IDENTIFIED_BY_PERSON_ID",
    "IDENTIFIED_DATE",
    "RELATED_PROJECT_ID",
    "ASSIGNED_TO_PERSON_ID",
    "STATUS",
    "PRIORITY"
FROM "#OWNER#"."IT_ISSUES"
WHERE assigned_to_person_id IS NULL

To edit report attributes:

Select the Report Attributes tab at the top of the page.

For ISSUE_SUMMARY, enter the following in the Heading field:

Summary

To sort by ISSUE_ID:

For all columns except ISSUE_ID, select Sort.

For IDENTIFIED_DATE, for Sort Sequence, select 1. By doing this, issues will be displayed by oldest first.

Edit the following attributes for IDENTIFIED_BY_PERSON_ID:

Click the Edit icon to the left of IDENTIFIED_BY_PERSON_ID.

Under Column Definition, for Column Heading, enter Identified By.

Under Tabular Form Element, for Display As, select Display as Text (based on LOV, does not save state).

Scroll down to Lists of Values.

For Named LOV, select PEOPLE.

Click the Next button (>) at the top of the page to go to IDENTIFIED_DATE.

Edit the following attributes for IDENTIFIED_DATE:

Under Column Formatting, for Number/Date Format, enter DD-MON-YYYY.

Click the Next button (>) at the top of the page to go to the RELATED_PROJECT_ID column.

Edit the following attributes for RELATED_PROJECT_ID:

Under Column Definition, for Column Heading, enter Related Project.

Under Tabular Form Element, for Display As, select Select List (named LOV)

Under List of Values, for Named LOV, select PROJECTS.

Click the Next button (>) at the top of the page to go to the ASSIGNED_TO_PERSON_ID column.

Edit the following attributes for ASSIGNED_TO_PERSON_ID:

Under Column Definition, for Column Heading, enter Assigned To.

Under Tabular Form Element, for Display As, select Select List (named LOV)

Under List of Values:

Named LOV - Select PEOPLE.

Display Null - Select Yes.

Null display value - Enter a hyphen (-).

Click the Next button (>) at the top of the page to go to the STATUS column.

Edit the following attributes for STATUS:

Under Tabular Form Element, for Display As, select Select List (named LOV).

Under List of Values, for Named LOV, select STATUS.

Click the Next button (>) at the top of the page to go to the PRIORITY column.

Edit the following attributes for PRIORITY:

Under Tabular Form Element, for Display As, select Select List (named LOV).

Under List of Values:

From Named LOV, select PRIORITIES.

For Display Null, select Yes.

For Null display value, enter a hyphen (-).

Click Apply Changes.

The Report Attributes page appears.

Under Messages, enter the following in When No Data Found Message:

No Unassigned Issues.

Click Apply Changes.

Delete the Unnecessary Cancel Button

The wizard created an unnecessary Cancel button.

To delete the Cancel button:

On the Page Definition for page 8, click CANCEL in the Buttons section.

Click Delete.

Click OK to confirm your selection.

Run the Page

The tabular form is now complete. To view the new form, click the Run Page icon. The Assign Open Issues form appears as shown in Figure 15-41.

Figure 15-41 Assign Open Issues

Description of Figure 15-41 follows
Description of "Figure 15-41 Assign Open Issues"

To assign an issue, make a selection from the Assigned To list and click Apply Changes. Notice that once an issue has been assigned, the issue no longer displays.

Add an Issue Summary by Project Report Page

The Issue Summary report enables users to select a project and to see a summary of issues related to that project. This report includes the following summary information:

Date first issue identified

Date last issue closed

Total number of issues

Number of issues by status

Number of open issues by priority

Assignments by status

Create the Report Page

To create this report, you code the information in two SQL statements. The first statement gathers information having a singular result and the second statement gathers information having multiple results.

To add an Issue Summary by Project report:

Go to the Application home page.

Click Create Page.

Select Report and click Next.

Select SQL Report and click Next.

For Page Attributes:

Page - Enter 9.

Page Name - Enter Issue Summary by Project.

Breadcrumb - Select Breadcrumb.

Parent Entry - Select Reports link.

Click Next.

For Tab Options, select Use an existing tab set and reuse an existing tab within that tab set.

For Tab Set, select Issue Tracker (Home, Dashboard, Projects...) and click Next.

For Use Tab, select T_REPORTS: label="Reports" and click Next.

For SQL Query:

Enter the following SQL SELECT statement:

SELECT MIN(identified_date) first_identified,
    MAX(actual_resolution_date) last_closed,
    COUNT(issue_id) total_issues,
    SUM(DECODE(status,'Open',1,0)) open_issues,
    SUM(DECODE(status,'On-Hold',1,0)) onhold_issues,
    SUM(DECODE(status,'Closed',1,0)) closed_issues,
    SUM(DECODE(status,'Open',decode(priority,null,1,0),0))
    open_no_prior,
    SUM(DECODE(status,'Open',decode(priority,'High',1,0),0))
    open_high_prior,
    SUM(DECODE(status,'Open',decode(priority,'Medium',1,0),0))
    open_medium_prior,
    SUM(DECODE(status,'Open',decode(priority,'Low',1,0),0))
    open_low_prior
FROM it_issues
WHERE related_project_id = :P9_PROJECT

Click Next.

For Report Attributes:

Region Template - Select List Region with Icon (Chart).

Report Template - Select default: vertical report, look 1 (include null columns)

For Region Name - Enter Summary.

Accept the remaining defaults and click Next.

Review your selections and click Finish.

Now that you have the first query, you need to edit the headings and create the item to control the related project. First, create a region to display above the report to contain the Project parameter.

Create a Search Region

To create a new region to display above the report:

From the Success page, click Edit Page 9.

The Page Definition for page 9, Issue Summary by Project, appears.

Under Regions, click the Create icon.

Select HTML and click Next.

Select HTML for region container and click Next.

For Display Attributes:

Title - Enter Issue Summary Report Parameters.

Region Template - Select Report Filter - Single Row.

Display Point - Select Page Template Body (2. items below region content).

For Sequence, enter 5.

Accept the remaining defaults and click Next.

Click Create Region.

Create the Project Item

To create the Project item:

Under Items, click the Create icon.

For Select Item Type, select Select List and click Next.

For Select List Control Type, accept the default, Select List, and click Next.

For Display Position and Name:

Item Name - Enter P9_PROJECT.

Sequence - Enter 31.

Region - Select Issue Summary Report Parameters (1) 5.

Click Next.

For List of Values:

Named LOV - Select PROJECTS.

Null Text - Enter:

- Select -

Null Value - Enter:

-1

Click Next.

For Item Attributes, accept the defaults and click Next.

For Default, enter -1.

Click Create Item.

Create a Go Button

To create a Go button to perform the query:

Under Buttons, click the Create icon.

For Button Region, select Issue Summary Report Parameters and click Next.

For Button Position, select Create a button displayed among this region's items and click Next.

For Button Attributes:

Button Name - Enter P9_GO.

Sequence - Enter 33.

Label - Enter Go.

Request - Enter Go.

Button Style - Select Template Based Button.

Template - Select Button.

Click Create Button.

Create a Reset Button

Now, create a Reset button and Reset branch to redisplay the default Issue Summary by Report Page.

To create a Reset button to clear the query:

Under Buttons, click the Create icon.

For Button Region, select Issue Summary Report Parameters and click Next.

For Button Position, select Create a button displayed among this region's items and click Next.

For Button Attributes:

Button Name - Enter P9_RESET.

Sequence - Enter 32.

Label - Enter Reset.

Request - Enter Reset.

Button Style - Select Template Based Button.

Template - Select Button.

Click Create Button.

To create a Reset branch:

Under Branches, select Create icon.

Accept defaults and click Next.

For Target, make these changes:

Page - Enter 9.

Reset Pagination for this page - Select the checkbox.

Clear Cache - Enter 9.

Click Next.

For When Button Pressed, select *P9_RESET.

Click Create Branch.

Create a Assignment by Status Region

To create a new region to display below the report:

Under Regions, click the Create icon.

Select Report and click Next.

Select SQL Report for region container and click Next.

For Display Attributes:

Title - Enter Assignments by Status.

Region Template - Select No Template.

For Sequence, enter 20.

Accept the remaining defaults and click Next.

For Enter SQL Query or PL/SQL function returning a SQL Query, enter:

SELECT p.person_name,i.status,
COUNT(i.issue_id) issues
FROM it_issues i, it_people p
WHERE i.related_project_id = :P9_PROJECT
    AND i.assigned_to_person_id = p.person_id
GROUP BY person_name, status

Click Next.

For Rows per Page, enter 20 and click Next.

For Conditional Display:

Condition Type - Select Value of Item in Expression 1 != Expression 2

Expression 1 - Enter P9_PROJECT

Expression 2 - Enter -1

Click Create Region.

Refine Region Appearance

To edit headings and report settings:

Under Regions, click Report next to Assignments by Status.

For Headings Type, select Custom.

For PERSON_NAME, change Heading to Assigned To.

For ISSUES, change Heading to Number of Issues.

Click Up Arrow at end of ISSUES to move above STATUS.

For ISSUES, change Column Alignment to right.

For PERSON_NAME, ISSUES and STATUS, select center for Heading Alignment.

For PERSON_NAME, ISSUES and STATUS, uncheck Sort checkbox.

For PERSON_NAME, ISSUES and STATUS, for Sort Sequence, select - .

Scroll down to Layout and Pagination. From Pagination Scheme, select Row Ranges 1-15 16-30 in select list (with pagination).

Scroll down to Messages. In When No Data Found Message, enter:

No issues found.

Click Apply Changes.

Edit Headings and Report Settings for Summary Report

Next, you need to edit the headings and report setting for the report region. You also need to set the report regions to conditionally display when the user has selected a project.

To edit the headings and report settings:

Under Regions, click Report next to Summary.

For Headings Type, select Custom.

Under Column Attributes:

Change the Heading for FIRST_IDENTIFIED to:

First Issue Identified:

Change the Heading for LAST_CLOSED to:

Last Issue Closed:

Change the Heading for TOTAL_ISSUES to:

Total Issues:

Change the Heading for OPEN_ISSUES to:

Open Issues:

Change the Heading for ONHOLD_ISSUES to:

On-Hold Issues:

Change the Heading for CLOSED_ISSUES to:

Closed Issues:

Change the Heading for OPEN_NO_PRIOR to:

Open Issues with No Priority:

Change the Heading for OPEN_HIGH_PRIOR:

Open Issues of High Priority:

Change the Heading for OPEN_MEDIUM_PRIOR to:

Open Issues of Medium Priority:

Change the Heading for OPEN_LOW_PRIOR:

Open Issues of Low Priority:

Scroll down to Layout and Pagination. Specify the following:

For Show Null Values as, enter a hyphen (-).

For Pagination Scheme, select - No Pagination Selected -.

Select the Region Definition tab at the top of the page.

Scroll down to Conditional Display. For Condition Type, make these changes:

Condition Type - Select Value of Item in Expression 1 != Expression 2

Expression 1 - Enter P9_PROJECT

Expression 2 - Enter -1

Click Apply Changes.

Run the Page

To see your newly created report, click the Run Page icon. Note that initially no data displays since no project is selected. Select a project and click Go. Your report should resemble Figure 15-42.

Figure 15-42 Issue Summary By Project

Description of Figure 15-42 follows
Description of "Figure 15-42 Issue Summary By Project"

Add Resolved by Month Identified Report Page

The Resolved by Month Identified report is a line chart. This report first calculates the number of days it took to resolve each closed issue, averaged by the month the issue was identified, and finally displayed by the month.

Add a Resolved by Month Identified Report Page

To add this report page:

Go to the Application home page.

Click Create Page.

Select Chart and click Next.

Select FLASH Chart and click Next.

For Page Attributes:

Page Number - Enter 10.

Page Name - Enter Resolved by Month Identified.

Region Template - Select No Template.

Region Name - Enter Resolved by Month Identified.

Breadcrumb - Select Breadcrumb.

Entry Name - Enter Resolved by Month Identified.

Parent Entry - Click Reports link.

Click Next.

For Tab Options, select Use an existing tab set and reuse an existing tab within that tab set.

For Tab Set, select Issue Tracker (Home, Dashboard, Projects...), and click Next.

For Use Tab, select T_REPORTS, and click Next.

For Chart Type, select 3D Column.

For Chart Animation, select Scale.

For Background Type, select Gradient.

For Background Color 1, enter #FFFFCC.

For Background Color 2, enter #FFCC66.

For Gradient Angle, enter 45.

For Color Scheme, select Look 5.

For X Axis Title, enter Month Identified.

For Y Axis Title, enter Days to Resolve.

Accept all other defaults and click Next.

For Query:

SQL - Enter the following:

SELECT NULL l,
    TO_CHAR(identified_date,'Mon RR') month,
    AVG(actual_resolution_date-identified_date) days
FROM it_issues
WHERE status = 'Closed'
GROUP BY TO_CHAR(identified_date,'Mon RR')

Note that this query has no link (that is, the l column). It extracts the month from the identified date so that the data can be grouped by month. Lastly, it calculates the average number of days it took for the issues to be closed that were identified in that month.

For When No Data Found Message, enter:

No Closed Issues found.

Click Next.

Review your selections and click Finish.

Edit the Chart

Next, modify month labels along x-axis to display at a 45 degree angle.

To edit the chart:

From the Success page, select Edit Page.

The Page Definition for page 10, Resolved by Month Identified, appears.

Under Regions, click Flash Chart, next to Resolved by Month Identified.

Under Display Settings, for Labels Rotation, enter 45.

Click Apply Changes.

Run the Page

To view your newly created flash chart, click the Run Page icon. Your flash chart should resemble Figure 15-43.

Figure 15-43 Resolved by Month Identified

Description of Figure 15-43 follows
Description of "Figure 15-43 Resolved by Month Identified"

Add a Calendar to Display Target Resolution Dates

The Target Resolution Dates report is a calendar that displays issues that have not yet closed along with the assigned person on the day that corresponds to the issue target resolution date.

Create a Calendar

To create a calendar of target resolution dates:

Go to the Application home page.

Click Create Page.

Select Calendar and click Next.

Select SQL Calendar and click Next.

For Page Attributes:

Page Number - Enter 11.

Page Name - Enter Target Resolution Dates.

Region Template - Select No Template

Region Name - Enter Target Resolution Dates.

Breadcrumb - Select Breadcrumb.

Parent Entry - Select Reports link.

Click Next.

For Tab Options, select Use an existing tab set and reuse an existing tab within that tab set.

For Tab Set, select Issue Tracker (Home, Dashboard, Projects...), and click Next.

For Use Tab, select T_REPORTS and click Next.

For Table/View Owner:

In Enter SQL Query, enter the following:

SELECT I.TARGET_RESOLUTION_DATE,
    I.ISSUE_SUMMARY ||' ('||nvl(P.PERSON_NAME,'Unassigned') ||') ' disp,
    I.ISSUE_ID
FROM IT_ISSUES I, IT_PEOPLE P
WHERE I.ASSIGNED_TO_PERSON_ID = P.PERSON_ID (+)
    AND (I.RELATED_PROJECT_ID = :P11_PROJECT OR :P11_PROJECT = '-1')
    AND I.STATUS != 'Closed'

Click Next.

Note that:

The target_resolution_date is the date on which the issue displays

The issue_summary is concatenated with the person assigned

The issue_id does not display, but is used to create a link to enable the user to view and edit the issue

For Date/Display Columns:

Date Column - Select TARGET_RESOLUTION_DATE.

For Display Column - Select DISP.

Click Next.

Review your selections and click Finish.

Create a Search Region

To create a new region to display above the calendar:

From the Success page, click Edit Page.

The Page Definition for page 11, Issue Summary by Project, appears.

Under Regions, click the Create icon.

Select HTML and click Next.

Select HTML for region container and click Next.

For Display Attributes:

Title - Enter Target Resolution Parameters.

Region Template - Select Report Filter - Single Row.

Display Point - Select Page Template Body (2. items below region content).

For Sequence, enter 5.

Accept the remaining defaults and click Create.

Add an Item to Support Project Look Up

To enable the user to look up one project or all projects, you need to add an item.

To add an item to support project look up:

Under Items, click the Create icon.

For Item Type, select Select List and click Next.

For Select List Control Type, select Select List and click Next.

For Display Position and Name:

Item Name - Enter P11_PROJECT.

Sequence - Enter 30.

Region - Select Target Resolution Parameters (1) 5.

Click Next.

For List of Values:

Named LOV - Select PROJECTS.

Display Null Option - Select Yes.

Null Text - Enter:

- All -

For Null Value - Enter:

-1

Click Next.

For Item Attributes, accept the defaults and click Next.

For Source, Default, enter:

-1

Click Create Item.

Create a Go Button

To create a Go button to execute the query:

Under Buttons, click the Create icon.

For Button Region, select Target Resolution Parameters (1) 5 and click Next.

For Button Position, select Create a button displayed among this region's items and click Next.

For Button Attributes:

Button Name - Enter P11_GO.

Sequence - Enter 40.

Show: - Select Beginning on New Field.

Label - Enter Go.

Request - Enter Go.

Button Style - Select Template Based Button.

Template - Select Button.

Click Create Button.

Create a Reset Button

Now, create a Reset button and Reset branch to redisplay the default Target Resolution Dates page.

To create a Reset button to clear the query:

Under Buttons, click the Create icon.

For Button Region, select Target Resolution Parameters (1) 5 and click Next.

For Button Position, select Create a button displayed among this region's items and click Next.

For Button Attributes:

Button Name - Enter P11_RESET.

Sequence - Enter 30.

Show: - Select Beginning on New Field.

Label - Enter Reset.

Request - Enter Reset.

Button Style - Select Template Based Button.

Template - Select Button.

Click Create Button.

To create a Reset branch:

Under Branches, select Create icon.

Accept defaults and click Next.

For Target, make these changes:

Page - Enter 11.

Reset Pagination for this page - Select the checkbox.

Clear Cache - Enter 11.

Click Next.

For When Button Pressed, select *P11_RESET.

Click Create Branch.

Modify Calendar Buttons

To move the Calendar buttons to the Search region and modify:

Under Buttons, click the Edit All icon.

Make the following changes for each button:

Region - Select Target Resolution Parameters.

Align - Select Right.

Position - Select Region Template Position #CREATE#.

Click Apply Changes.

Modify Calendar Attributes

Lastly, you need to modify the Calendar Attributes to add link support for viewing and editing the displayed issues. To accomplish this, you need to call page 7, Issue Details, to clear any data from the page and pass in the current issue ID along with the fact that page 11 was the calling page. Then, you need to add a note that displays when the query excludes Closed issues.

To modify the Calendar Attributes:

Click Page 11 breadcrumb.

Under Regions, click Calendar to the right of Target Resolution Dates

Scroll down to Column Link, enter the following:

Target is a - Select URL.

URL Target - Enter:

f?p=&APP_ID.:7:&SESSION.::&DEBUG.:7:P7_ISSUE_ID,P7_PREV_PAGE:#ISSUE_ID#,11

Select the Region Definition tab at the top of the page.

Scroll down to Header and Footer.

In Region Footer, enter the following:

This excludes Closed issues.

Click Apply Changes.

Run the Page

To see your newly created calendar, click the Run Page icon. Note that you can click Weekly or Daily to see the corresponding calendar views. You can run the Issues page to find Target Resolution Dates. Then, run this Target Resolution Dates page and use the <Previous, and Next> buttons to navigate to the month of the target resolution date. You'll see the issue appear similar to the issue shown for Sunday January 13,2008 in Figure 15-44.

Note that you can also click the text displayed for an issue to display the Edit Issue page. To return to the calendar, click Cancel.

Note:

Your data will have different dates because the insert scripts for the data are set relative to your system date; they are not hard coded. The dates will be different each time the script is inserted.

Figure 15-44 Target Resolution Dates

Description of Figure 15-44 follows
Description of "Figure 15-44 Target Resolution Dates"

Add a Bar Chart to Display Average Days to Resolve

The Average Days to Resolve report is a bar chart that calculates the number of days it takes to resolve each closed issue and averages that number by assigned person.

Add a Bar Chart

To add the Average Days to Resolve report:

Go to the Application home page.

Click Create Page.

Select Chart and click Next.

Select Flash Chart and click Next.

For Page Attributes:

Page - Enter 12.

Page Name - Enter Average Days to Resolve.

Region Template - Select No Template

Region Name - Enter Average Days to Resolve.

Breadcrumb - Select Breadcrumb.

Entry Name - Enter Average Days to Resolve.

Parent Entry - Select Reports link.

Accept the remaining defaults and click Next.

For Tab Options, select Use an existing tab set and reuse an existing tab within that tab set.

For Tab Set, select Issue Tracker (Home, Dashboard, Projects...) and click Next.

For Use Tab, select T_REPORTS and click Next.

For Chart Preview:

Chart Type - Select Horizontal 2D Column.

X Axis - Enter Days.

Click Next.

For Query:

For SQL Query or PL/SQL function returning a SQL Query - Enter the following:

SELECT NULL l,
                    NVL(p.person_name,'None Assigned') person,
                    AVG(i.actual_resolution_date-i.identified_date) days
                FROM it_issues i, it_people p
                WHERE i.assigned_to_person_id = p.person_id (+)
                    AND i.status = 'Closed'
                    GROUP BY p.person_name

In the above SELECT statement:

The first item selected is the link. This report does not link to any other page, and so NULL was selected.

The second item is the person's name, or None Assigned if assigned_to is NULL.

The third item selected is the average number of days it took for that person to resolve all their issues so the issues have a status of closed.

For When No Data Found Message, enter No issues with status 'Closed'.

Accept the remaining defaults and click Next.

Review your selections and click Finish.

Run the Page

To view your newly created bar chart, click Run Page. Your report should resemble Figure 15-45.

Figure 15-45 Average Days to Resolve

Description of Figure 15-45 follows
Description of "Figure 15-45 Average Days to Resolve"

Add a Dashboard Page

Now that you have completed all the detail pages, you next need to create the Dashboard, add content to add the Dashboard and tie all the pages together. In this section, you create a Dashboard, as shown in Figure 15-46, "Dashboard", to display the following information:

Topics in this section include:

Overview of Dashboard Page

Create Dashboard Page

Add An Overdue Issues Report

Add an Unassigned Issues Report

Add a Recently Opened Issues Report

Add an Open Issues by Project Pie Chart

Overview of Dashboard Page

The Dashboard provides a quick snapshot of important issue tracking statistics. This page is for reporting only; no changes or new entries can be made on this page. Information displayed on the Dashboard includes:

Overdue Issues

Unassigned Issues

Recently Opened Issues

Open Issues by Project as a chart

Upon completion of this section, the application will have a Dashboard page similar to the one shown in Figure 15-46, "Dashboard".

Figure 15-46 Dashboard

Description of Figure 15-46 follows
Description of "Figure 15-46 Dashboard"

Create Dashboard Page

To add the Dashboard page follow these steps:

Go to the Application home page.

Click Create Page.

Select Blank Page and click Next.

For Page Number, enter 18 and click Next.

For Create Page, make these changes:

Name - Enter Dashboard.

Title - Enter Dashboard.

Breadcrumb - Select Breadcrumb.

Entry Name - Enter Dashboard.

Parent Entry - Select Home link.

Click Next.

Select Yes - Use an existing tab set and reuse an existing tab within that tab set and click Next.

For Existing Tab Set, select Issue Tracker (Home, Dashboard, Projects...) and click Next.

For Select tab you would like to designate as "current" for this page:, select T_HOME: label="Home" and click Next.

Review selections and click Finish.

Select application home page breadcrumb.

Select Shared Components.

Under Navigation, select Tabs.

Click Edit icon to the left of the Home tab.

For Tab Name, enter T_DASHBOARD.

For Tab Label, enter Dashboard.

Under Current For Pages, for Tab Page, enter 18.

Click Apply Changes.

Add An Overdue Issues Report

Next, add some content to the Dashboard. In this exercise, you add a report to display overdue issues. The query for this report retrieves all unclosed issues with a past target resolution date.

Add a Report of Overdue Issues

To add a report to display overdue issues:

Click application home page breadcrumb.

Click 18 - Dashboard.

Under Regions, click the Create icon

Select Report and click Next.

For Report Implementation, select SQL Report and click Next.

For Display Attributes:

Title - Enter Overdue Issues.

Region Template - Select Reports Region, Alternative 1.

Sequence - Enter 5.

Click Next.

For Source, enter the following in Enter SQL Query:

SELECT i.issue_id, i.priority, i.issue_summary,
    p.person_name assignee, i.target_resolution_date, r.project_name
FROM it_issues i, it_people p, it_projects r
WHERE i.assigned_to_person_id = p.person_id (+)
    AND i.related_project_id = r.project_id
    AND i.target_resolution_date < sysdate
    AND i.status != 'Closed'

The outer join is necessary because the assignment is optional.

Click Next.

For Report Template, select template: 20. Standard

Click Create Region.

Edit the Overdue Issues Report

Now that the region has been created, you need to edit the headings and turn the summary into a link to display the issue details.

To edit the column headings:

Under Regions, click Report next to Overdue Issues.

For Headings Type, select Custom.

For ISSUE_SUMMARY, enter the following for Heading:

Summary

For ASSIGNEE, change the Heading to:

Assigned To

For TARGET_RESOLUTION_DATE:

Target

Use Up and Down arrows to far right of each column to order columns in the following order: ISSUE_ID, ASSIGNEE, TARGET_RESOLUTION_DATE, PROJECT_NAME, PRIORITY, ISSUE_SUMMARY.

For ISSUE_ID, deselect Show.

This enables the query to pass in the link, but not display it.

Select Sort only for ASSIGNEE, TARGET_RESOLUTION_DATE and PROJECT_NAME. Deselect Sort for all others.

Select left for Heading Alignment for TARGET_RESOLUTION_DATE.

Select center for Heading Alignment for all columns except TARGET_RESOLUTION_DATE.

For TARGET_RESOLUTION_DATE, select 1 for Sort Sequence.

For ISSUE_ID, select - for Sort Sequence.

To edit column attributes for ISSUE_SUMMARY:

Click the Edit icon to the left of ISSUE_SUMMARY.

Scroll down to Column Link:

For Link Text, enter:

<table width="200" style=size:9><tr><td>#ISSUE_SUMMARY#</td></tr></table>

For Link Attributes, enter:

title="Click to edit"

For Page, select 7.

For Clear Cache, select 7.

For Item 1, enter the Name:

P7_ISSUE_ID

For Item 1, enter the Value:

#ISSUE_ID#

For Item 2, enter the Name:

P7_PREV_PAGE

For Item 2, enter the Value:

18

Click Apply Changes.

Under Messages, enter the following in When No Data Found Message

No Overdue Issues.

Click Apply Changes.

Run Application

Run your application by clicking the run page icon. You should see the Dashboard page with the Overdue Issues region added as shown in Figure 15-47.

Figure 15-47 Dashboard with Overdue Issues Region Added

Description of Figure 15-47 follows
Description of "Figure 15-47 Dashboard with Overdue Issues Region Added"

Add an Unassigned Issues Report

The next report you add displays unassigned, open issues. This report is very similar to Overdue Issues. Rather than creating it manually, you can copy the Overdue Issues report and modify it.

To create a new report by copying an existing report:

Click the Edit Page 18 link in the Developer Toolbar at bottom of the page.

Under Regions, click the Copy icon.

In the Name column, click Overdue Issues.

For To Page, accept the default 18, accept all other defaults and click Next.

For Region Name, enter Unassigned Issues.

For Sequence, enter 10 and click Copy Region.

To modify the query and edit the report region:

Under the Regions section, click Unassigned Issues.

For Region Source, replace the existing statements with the following:

SELECT i.issue_id,
    i.priority,
    i.issue_summary,
    i.target_resolution_date,
    r.project_name,
    p.person_name identifiee
FROM it_issues i,
    it_people p,
    it_projects r
WHERE i.assigned_to_person_id IS NULL
    AND i.status != 'Closed'
    AND i.related_project_id = r.project_id
    AND i.identified_by_person_id = p.person_id

Select the Report Attributes tab at the top of the page.

Note that previously defined columns have retained their modified attributes.

Under Column Attributes for IDENTIFIEE, enter the following Heading:

Identified By

Under Messages, enter the following in When No Data Found Message:

No Unassigned Issues.

Use Up and Down arrows to far right to reorder columns as follows: ISSUES_ID, IDENTIFIEE, TARGET_RESOLUTION_DATE, PROJECT_NAME, PRIORITY, and ISSUE_SUMMARY.

Click Apply Changes.

Run Application

Run your application by clicking the run page icon. The Dashboard appears. Scroll down to the bottom of the page. You should see the Unassigned Issues region as shown in Figure 15-48.

Figure 15-48 Unassigned Issues Region

Description of Figure 15-48 follows
Description of "Figure 15-48 Unassigned Issues Region"

Add a Recently Opened Issues Report

Next, you add a report of recently opened issues. The underlying query displays the five most recently opened issues within the past week.

To create a report of recently opened issues by copying an existing report:

Click the Edit Page 18 link in the Developer Toolbar at the bottom of the page.

Under Regions, click the Copy icon.

Under Name, select Unassigned Issues.

For To Page, accept the default 18, accept the remaining defaults, and click Next.

For Region Name, enter Recently Opened Issues.

For Sequence, enter 5.

For Column, select 2.

Click Copy Region.

To modify the query and edit the report region:

Under the Regions section, click Recently Opened Issues.

For Region Source, replace the existing statements with the following:

SELECT issue_id,
    priority,
    issue_summary,
    assignee,
    target_resolution_date,
    project_name,
    identifiee
FROM
    (SELECT i.issue_id,
        i.priority,
        i.issue_summary,
        p.person_name assignee,
        i.target_resolution_date,
        r.project_name,
        p2.person_name identifiee
    FROM it_issues i,
        it_people p,
        it_people p2,
        it_projects r
    WHERE i.assigned_to_person_id = p.person_id (+)
        AND i.related_project_id = r.project_id
        AND i.identified_by_person_id = p2.person_id
        AND i.created_on > (sysdate - 7)
ORDER BY i.created_on desc)
WHERE rownum < 6

Select the Report Attributes tab at the top of the page.

For all columns:

Disable sorting by deselecting Sort.

Set Sort Sequence to -.

For ASSIGNEE, click the up arrow to the right of the Sort Sequence column until ASSIGNEE appears before ISSUE_SUMMARY.

For ASSIGNEE, change Heading to:

Assigned To

Scroll down to the Layout and Pagination section. From Pagination Scheme, select - No Pagination Selected -.

Under Messages, enter the following in When No Data Found Message:

No Recently Opened Issues.

Click Apply Changes.

Run Application

Run your application and use the Issues Details page to add an Issue to the database. After adding the new issue, click on the Dashboard tab. At the top right side of the page you should see the Recently Opened Issues region, as shown in Figure 15-49, displaying the newly added issue.

Figure 15-49 Recently Assigned Issues Region

Description of Figure 15-49 follows
Description of "Figure 15-49 Recently Assigned Issues Region"

Add an Open Issues by Project Pie Chart

Next, add a pie chart displaying Open Issues by Project.

To add a pie chart:

Click the Edit Page 18 link in the Developer Toolbar at the bottom of the page.

Under Regions, click the Create icon.

Select Chart and click Next.

Select Flash Chart and click Next.

For Display Attributes, make these changes:

Title - Enter Open Issues by Project.

Region Template - Select Chart Region.

Sequence - Enter 10.

Column - Select 2.

Click Next.

For Chart Preview, make these edits:

Chart Type - Select 3D Pie.

Click Next.

For Source, enter the following in SQL:

SELECT 'f?p=&APP_ID.:6:&SESSION.:::CIR:IREQ_STATUS,
    IREQ_PROJECT_ID:Open,'||r.project_id LINK,
    NVL(r.project_name,'No Project') label,
    COUNT(r.project_name) value
FROM it_issues i, it_projects r
WHERE i.status = 'Open' AND i.related_project_id = r.project_id
    GROUP BY NULL, r.project_name, r.project_id
    ORDER BY r.project_name, r.project_id

For When No Data Found Message, enter No open issues.

Click Create Region.

To edit the chart.

Under Regions, click Flash Chart next to Open Issues by Project.

Under Chart Settings, make these changes: For Chart Width, enter 550.

Chart Height, enter 325.

Chart Margin: Bottom, enter 25.

Chart Margin: Right, enter 50.

Under Display Settings, deselect Show Values.

Click Apply Changes.

Run the Page

To view the revised page, click the Run Page icon. In Figure 15-50, "Final Dashboard with All Regions Added", three overdue issues where closed before going to the Dashboard.

Figure 15-50 Final Dashboard with All Regions Added

Description of Figure 15-50 follows
Description of "Figure 15-50 Final Dashboard with All Regions Added"

Adding Advanced Features

Once your application is fully functional you can focus on adding advanced features outlined during the planning and project analysis phase.

Topics in this section include:

Add Support for Email Notification

Add Application Security

Add Support for Email Notification

The planning and project analysis phase produced two email requirements:

Notify people when an issue is assigned to them

Notify the project lead when any issue becomes overdue

Topics in this section include:

How Email Notification Works

Add Notification of New Assignments

Add Notification for Overdue Issues

For additional examples on this topic, please visit the following Oracle by Examples (OBEs):

Sending Email Attachments in Oracle Application Express 3.1

http://www.oracle.com/technology/obe/apex/apex31nf/apex31email.htm

How Email Notification Works

To send mail from within an Oracle Application Express application, you create a PL/SQL process that calls the supplied APEX_MAIL package.

Email is not sent immediately, but is stored in a temporary queue until a DBMS_JOB pushes the queue. The DBMS_JOB utilizes two preferences, SMTP Host Address and SMTP Host Port, to send mail in the queue. By default, these preferences are set to localhost and 25. If Oracle Application Express is not configured for SMTP services, you need to change your Email Environment Settings.

See Also:

"How to Send Email from an Application" in Oracle Database Application Express User's Guide to learn about configuring Email Environment settings.

The following is a description of the SEND procedure of the APEX_MAIL package.

PROCEDURE SEND
Argument Name                  Type                    In/Out Default?
------------------------------ ----------------------- ------ --------
P_TO                           VARCHAR2                IN
P_FROM                         VARCHAR2                IN
P_BODY                         VARCHAR2 or CLOB        IN
P_BODY_HTML                    VARCHAR2 or CLOB        IN     DEFAULT
P_SUBJ                         VARCHAR2                IN     DEFAULT
P_CC                           VARCHAR2                IN     DEFAULT
P_BCC                          VARCHAR2                IN     DEFAULT
P_REPLYTO                                      VARCHAR2                IN

Add Notification of New Assignments

First, you add a notification to a person when the person has a new assignment. An assignment can be made or changed from two different pages: Issue Details and Assign Open Issues.

On the Issue Details page, you can store the initial values and check them against any changes to see if an assignment has been made or changed. The Assign Open Issues is a tabular form, so there is no way to check the old values against the new values. For that reason, the best way to implement the notification is with a before insert and update trigger on IT_ISSUES. You can create this trigger programmatically using SQL Workshop.

Create a Trigger on IT_ISSUES

To create a before insert and update trigger on IT_ISSUES:

On the Workspace home page, click SQL Workshop and then Object Browser.

Click Create.

For Select the type of database object you want to create, click Trigger.

For Table Name, select IT_ISSUES and click Next.

For Define:

For Trigger Name, enter IT_ISSUES_AIU_EMAIL.

For Firing Point, select AFTER.

For Options, select insert, update.

For Trigger Body, enter the following:

IF (INSERTING AND :new.assigned_to_person_id IS NOT NULL)
    OR
    (UPDATING AND (:old.assigned_to_person_id IS NULL OR :new.assigned_to_person_id != :old.assigned_to_person_id) AND :new.assigned_to_person_id IS NOT NULL) THEN
    FOR c1 IN
        (SELECT person_name, person_email
        FROM it_people
        WHERE person_id = :new.assigned_to_person_id)
    LOOP
        IF c1.person_email IS NOT NULL THEN
             FOR c2 IN
                 (SELECT project_name
                 FROM it_projects
                 WHERE project_id = :new.related_project_id)
             LOOP

             APEX_MAIL.SEND(
                 p_to => c1.person_email,
                 p_from => c1.person_email,
                 p_body =>
                 'You have been assigned a new issue.  ' ||chr(10)||
                 'The details are below. ' ||chr(10)||
                 chr(10)||
                 ' Project: '|| c2.project_name ||chr(10)||
                 ' Summary: '||:new.issue_summary ||chr(10)||
                 ' Status: '||:new.status ||chr(10)||
                 'Priority: '||nvl(:new.priority,'-'),
                  p_subj => 'New Issue Assignment');
            END LOOP;
        END IF;
    END LOOP;
END IF;

Replace the p_to and p_from with your own valid 'email address'.

Click Next.

To review the code, expand the SQL arrow.

Click Finish.

Test Email Notification

You can test this trigger by:

Modifying one of the users to have a valid email address.

Assigning an unassigned issue to this user.

Checking the valid email inbox for an notification email.

To test your new trigger:

Run your Issue Tracker application.

Click the Users tab.

Click edit icon next to Carla Downing.

For Email Address, enter a valid 'email address'.

Click Apply Changes.

Click Reports tab.

Click Assign Open Issues link.

For Assigned To, select Carla Downing.

Click Apply Changes.

Wait a couple minutes, then check the destination email inbox. You should see an email where the Subject is New Issue Assignment and containing a body similar to Figure 15-51, "Email Notification Body".

Figure 15-51 Email Notification Body

Description of Figure 15-51 follows
Description of "Figure 15-51 Email Notification Body"

Add Notification for Overdue Issues

The second email notification notifies the project lead whenever an issue becomes overdue. An issue becomes overdue when the target resolution date has passed, but the issue is not yet closed. There is no human interaction to determine if an issue is overdue, so you cannot check for it on a page or in a trigger.

The best way to check for overdue issues is to write a package that queries the IT_ISSUES table. If it finds any overdue issues, the package initiates an email to the Project Lead. This procedure checks for issues by project so that the project lead can receive just one email with all overdue issues rather than an email for each issue. The package will be called once a day by a dbms_job.

You can use the Create Object function as follows:

Create the package and package body from within the SQL Workshop

Use SQL Command Processor to run the create commands

To create the package:

On the Workspace home page, click SQL Workshop and then SQL Commands.

SQL Commands appears.

Enter the following in the field provided:

CREATE OR REPLACE package it_check_overdue_issues
AS
    PROCEDURE email_overdue;
END;
/

Click Run.

To create the package body:

On the Workspace home page, click SQL Workshop and then SQL Commands.

SQL Commands appears.

Enter the following in the field provided:

CREATE OR REPLACE PACKAGE BODY it_check_overdue_issues
AS

PROCEDURE email_overdue
IS
    l_msg_body varchar2(32000) := null;
    l_count number             := 0;
BEGIN

FOR c1 IN
    (SELECT pr.project_id,
        pr.project_name,
        pe.person_name,
        pe.person_email
    FROM it_projects pr,
        it_people pe
    WHERE pr.project_id = pe.assigned_project
        AND pe.person_role = 'Lead')
    LOOP
    FOR c2 IN
        (SELECT i.target_resolution_date,
            i.issue_summary,
            p.person_name,
            i.status,
            i.priority
        FROM it_issues i,
            it_people p
        WHERE i.assigned_to_person_id = p.person_id (+)
            AND i.related_project_id = c1.project_id
            AND i.target_resolution_date < SYSDATE
            AND i.status != 'Closed'
    ORDER BY i.target_resolution_date, i.issue_summary)
LOOP
    IF l_count = 0 THEN
        l_msg_body :=
        'As of today, the following issues '||
        'are overdue:'||chr(10)||
        chr(10)||
        ' Project: '|| c1.project_name ||chr(10)||
        chr(10)||
        '     Target: '||c2.target_resolution_date ||chr(10)||
        '    Summary: '||c2.issue_summary ||chr(10)||
        ' Status:     '||c2.status ||chr(10)||
        ' Priority:   '||c2.priority ||chr(10)||
        'Assigned to: '||c2.person_name;
    ELSE
        l_msg_body := l_msg_body ||chr(10)||
        chr(10)||
        '     Target: '||c2.target_resolution_date ||chr(10)||
        '    Summary: '||c2.issue_summary ||chr(10)||
        '     Status: '||c2.status ||chr(10)||
        ' Priority:   '||c2.priority ||chr(10)||
        'Assigned to: '||c2.person_name;
    END IF;
    l_count := l_count + 1;
END LOOP;

IF l_msg_body IS NOT NULL THEN
-- APEX_MAIL.SEND(
--    p_to => c1.person_email,
--    p_from => c1.person_email,
--    p_body => l_msg_body,
--   p_subj => 'Overdue Issues for Project '||
                   c1.project_name);
END IF;
l_count := 0;

END LOOP;

END email_overdue;

END it_check_overdue_issues;
/

To make this work within your environment, uncomment the APEX_MAIL.SEND and replace the p_to and p_from with your own valid email address.

Click Run.

Next, you want to update the demonstration data to include your employees' valid email addresses.

To update demonstration data to include valid email addresses:

On the Workspace home page, click SQL Workshop and then Object Browser.

From the Object list on the left side of the page, select Tables.

Select the IT_PEOPLE table.

Select the Data tab.

For each person, edit the email address:

Click the Edit icon.

Change Person Email to a valid email address.

Click Apply Changes.

Repeat step 5 for all people within the IT_PEOPLE table.

Return to the Workspace home page by clicking the Home breadcrumb link.

Next, you want to create a DBMS_JOB that executes your newly created package at a time interval you specify.

To create the DBMS_JOB:

The following is an example of a DBMS_JOB that executes your newly created package. To make this a valid DBMS_JOB, however, you need to set the interval appropriately and execute it using SQL Commands within the SQL Workshop.

DECLARE
    jobno number;
BEGIN
    DBMS_JOB.SUBMIT(
        job => jobno,
        what => 'BEGIN it_check_overdue_issues.email_overdue; END;',
        next_date => SYSDATE,
        interval => desired_interval);
    COMMIT;
END;
/

For this DBMS_JOB, replace desired_interval with the appropriate interval. For example, to have this job execute once each day, you would replace desired_interval with the following:

'TRUNC(SYSDATE)+(25/24)'

See Also:

Send email from Application Express applications How To on OTN at:

http://www.oracle.com/technology/products/database/application_express/howtos/index.html

Add Application Security

The planning and project analysis phase produced two security requirements:

Only the CEO and Managers can define and maintain projects and users

Once assigned, only the person assigned or a project lead can change data about the issue

Within Oracle Application Express, you can define authorization schemes. Authorization controls user access to specific controls and components, such as validations, processes and branches, based on user privileges. Once defined, you can associate an authorization scheme with any page, region, or item to restrict access. Each authorization scheme is run only when needed and is defined to validate either once for each page view or once for each session.

Topics in this section include:

Restrict Project and People Definition

Restrict Issue Modification

For additional examples on this topic, please visit the following Oracle by Examples (OBEs):

Adding Security to your Application

http://www.oracle.com/technology/obe/hol08/apexintro/apex3.1.1_d/apex3.1.1_d_otn.htm

See Also:

Session state Protection in the Oracle Database Application Express User's Guide

Restrict Project and People Definition

The first requirement states that only the CEO and Managers may define and maintain projects and people. To address this requirement, you:

Create an authorization scheme to check the current user's role

Associate the authorization scheme with the items on the Projects and Users report that navigate to the Project Details and User Information pages

Associate the authorization scheme with the Project Details and User Information pages themselves so that a user cannot bypass the security by manually editing the URL to the target page

To reference the current user, use the session variable:APP_USER. This session variable is compared with the person's email address (which is the same as their workspace or workspace name). Whenever coding this type of security, you should always code in a user that can pass all security. You may find this user very useful for development and testing. If you do not take this approach, you may not be able to access the restricted pages unless you define yourself as the CEO or Manager.

Create the Authorization Scheme

Before applying the authorization scheme created in the following steps, create a user with the user name of HOWTO. The HOWTO user will have authorization to see the edit links on the Projects and Issues pages. Then, create another user, HOWTO2. This user should not be able to see the links.

See Also:

"Create Users"

To create the authorization scheme:

On the Workspace home page, click Application Builder.

Select the Issue Tracker application.

Click Shared Components.

Under Security, click Authorization Schemes.

Click Create.

For Create Authorization Scheme, accept the default, From Scratch, and click Next.

Under Authorization Scheme, enter the following in Name:

USER_CEO_OR_MANAGER

Under Authorization Scheme:

Scheme Type - Select Exists SQL Query.

Expression 1 - Enter:

SELECT '1'
FROM it_people
WHERE (upper(username) = UPPER(:APP_USER) AND
       person_role IN ('CEO','Manager')) OR
      (UPPER(:APP_USER) = 'HOWTO')

Identify error message displayed when scheme violated - Enter:

You are not authorized to access this function.

Scroll down to Evaluation Point. For Validate authorization scheme, select Once per session.

This selection is sufficient in this instance as the assigned role typically does not change within a given session.

Click Create.

Next, you need to associate the authorization scheme with the appropriate objects.

Associate Objects on the Projects Report

To associate the authorization scheme with the Projects report:

Click the Edit Page icon in the upper right corner. The Edit Page icon resembles a small green piece of paper and pencil.

In Page, enter 2 and click Go.

The Page Definition for page 2, Projects, appears.

Under Regions, click Interactive Report next to Projects.

Scroll down to Link Column and for authorization Scheme, select USER_CEO_OR_MANAGER.

Click Apply Changes.

To associate the authorization scheme with the Create button on the Projects report:

Under Buttons on the Page Definition for page 2, click the Add Project> link.

The Edit Page Buttons page appears.

Under Authorization, select the Authorization Scheme USER_CEO_OR_MANAGER.

Click Apply Changes.

Associate Objects with the Project Details Form

To associate the authorization scheme with the Project Details page:

Go to page 3 by clicking the Next Page (>) button.

The Page Definition for page 3, Project Details, appears.

Under Page, click the Edit page attributes icon.

The Page attributes page appears.

Under Security, select the Authorization Scheme USER_CEO_OR_MANAGER.

Click Apply Changes.

Associate Objects with the User Report

To associate the authorization scheme with the Users report.

Go to page 4 by clicking the Next Page (>) button.

The Page Definition for page 4, Users, appears.

Under Regions, click Interactive Report next to Users.

Scroll down to Link Column and for Authorization Scheme, select USER_CEO_OR_MANAGER.

Click Apply Changes.

To associate the authorization scheme with the Add User button on the User report:

Go to page 5 by clicking the Next Page (>) button.

The Page Definition for page 5 appears.

Under Buttons, click the Create link (not the icon).

The Edit Page Buttons page appears.

Under Authorization, select the Authorization Scheme USER_CEO_OR_MANAGER.

Click Apply Changes.

Associate Objects with the User Information Form

To associate the authorization scheme with the User Information page:

Under Page, click the Edit page attributes icon.

The Page attributes page appears.

Under Security, select the Authorization Scheme USER_CEO_OR_MANAGER.

Click Apply Changes.

Restrict Issue Modification

The second requirement states that once an issue has been assigned, only the person assigned (or a project lead) can change data about the issue. This requirement is a little trickier since it changes for every issue.

Currently, there are two pages that enable users to modify an issue: the Issue Details page and the Assign Open Issues page. On the Assign Open Issues page, the only issues that are displayed are those that are unassigned. Because the issues are unassigned, security is not necessary.

Although other users are not allowed to change the data, you do want to enable users to view all the detailed data about an issue so that they can view the progress and resolution. Given this requirement, the best approach is to create an authorization scheme to be evaluated once for each page view.

The authorization scheme will be associated with both the Apply Changes and Delete buttons on the Issue Details page. This way, unauthorized users can view all the details, but if they do change something, they have no way of saving that change.

For added security, you can also associate the authorization scheme with the process that performs the insert, update and delete on IT_ISSUES. This protects your application against someone changing the URL to call the Apply Changes process. To let users know why they are not able to make changes, you can add an HTML region that displays an explanation when the authorization fails. The SQL for this scheme must be specific to the Issues Details page because it needs to reference P7_ISSUE_ID. It also needs to retrieve data from the database because at the time it is evaluated, the necessary data will not be available in the session state. The only item that will be available will be P7_ISSUE_ID because it will be passed by the link.

Create the Authorization Scheme

To create the authorization scheme:

Go to the Application home page.

Click Shared Components.

Under Security, click Authorization Schemes.

Click Create.

For Creation Method, accept the default From Scratch and click Next.

Under Authorization Scheme, enter the following in Name:

P7_ASSIGNED_OR_PROJECT_LEAD

Under Authorization Scheme:

For Scheme Type, select PL/SQL Function Returning Boolean.

For Expression 1, enter:

DECLARE
    l_related_project  integer;
    l_assigned_to      integer;
    l_person_id        integer;
    l_person_role      varchar2(7);
    l_assigned_project integer;
BEGIN

-- User is HOWTO or new Issue
IF :APP_USER = 'HOWTO' OR
    :P7_ISSUE_ID is null THEN
    RETURN true;
END IF;

FOR c1 IN (SELECT related_project,
    assigned_to_person_id
    FROM it_issues
    WHERE issue_id = :P7_ISSUE_ID)
LOOP
    l_related_project := c1.related_project;
    l_assigned_to     := c1.assigned_to_person_id;
END LOOP;

-- Issue not yet assigned
IF l_assigned_to is null THEN
    RETURN true;
END IF;

FOR c2 IN (SELECT person_id,
      person_role,
      assigned_project
      FROM it_people
      WHERE upper(person_email) = upper(:APP_USER))
LOOP
    l_person_id        := c2.person_id;
    l_person_role      := c2.person_role;
    l_assigned_project := c2.assigned_project;
END LOOP;

-- User is lead of related project
IF l_person_role = 'Lead' AND
    l_assigned_project = l_related_project THEN
    RETURN true;

    -- User is assigned to issue
    ELSEIF l_assigned_to = l_person_id THEN
        RETURN true;
    ELSE
       RETURN false;
    END IF;
END;

For Identify error message displayed when scheme violated, enter:

This issue is not assigned to you, nor are you the Project Lead. Therefore you are not authorized to modify the data.

Under Evaluation Point, for Validate authorization scheme, select Once per page view.

This selection is necessary since each issue may have a different result.

Click Create.

Now you need to associate the authorization scheme with the appropriate objects on the Issue Details page.

Associate Objects with the Create Edit Issues Report

To associate the authorization scheme with buttons and processes:

Go to the Application home page.

Select page 7 - Issue Details.

Under Buttons, click Delete.

Under Authorization, select the Authorization Scheme P7_ASSIGNED_OR_PROJECT_LEAD.

Click Apply Changes.

Under Buttons, click Apply Changes.

Under Authorization, select the Authorization Scheme P7_ASSIGNED_OR_PROJECT_LEAD.

Click Apply Changes.

Under Buttons, click Create.

Under Authorization, select the Authorization Scheme P7_ASSIGNED_OR_PROJECT_LEAD.

Click Apply Changes.

Under Buttons, click Create and Create Another.

Under Authorization, select the Authorization Scheme P7_ASSIGNED_OR_PROJECT_LEAD.

Click Apply Changes.

Under Page Processing, Processes, select Process Row of IT_ISSUES.

Under Authorization, select the Authorization Scheme P7_ASSIGNED_OR_PROJECT_LEAD.

Click Apply Changes.

Create an HTML Region

Lastly, create a new region to display an explanation when the authorization fails

To create a new region:

One Page 7 under Regions, click the Create icon.

On Region, accept the default HTML and click Next.

Select HTML for region container and click Next.

For Display Attributes:

For Title, enter Not Authorized.

For Display Point, select Page Template Body (2. items below region content).

For Sequence, enter 30.

Click Next.

For Source, enter the following in Enter HTML Text Region Source and click Next:

You are not authorized to modify the data for this issue because<br>you are not the Project Lead nor is the issue assigned to you.

For Authorization Scheme, select {Not P7_ASSIGNED_OR_PROJECT_LEAD}. This selection makes the region only display when the Authorization Scheme fails.

Click Create Region.

Figure 15-52, "New Region Displaying Authorization Failure" displays the Issue Details page being run by a person for whom the Authorization fails. Notice a new region displays at the top of the page and that the only button being displayed is Cancel.

Figure 15-52 New Region Displaying Authorization Failure

Description of Figure 15-52 follows
Description of "Figure 15-52 New Region Displaying Authorization Failure"

A more elegant solution to this security requirement would be to create a different page for viewing the details of an issue. You would need to have a procedure that would take in the issue_id and current user and pass back a flag for view only or edit. Then you could dynamically build the link for all the reports to call either the View page or the Edit page based upon a call to that procedure. You would still want to protect against someone accessing the edit page without using a link so you would also check permission before firing the insert, update and delete process.

Deploying Your Application

Now that your application is complete, the next step is to deploy it. Typically, developers create applications on one server and deploy it on another. Although this approach is not required, it enables you to resolve bugs without impacting the production instance.

Note:

To deploy an application on another server, you need to install and configure another Oracle Application Express instance.

Topics in this section include:

Move the Application Definition

Alternate Authentication Mechanisms to Consider

Create Users

Publish the URL

Move the Application Definition

The definition for your application lives within the Oracle database. The application definition includes everything that makes up the application, including the templates, but it does not include database object definitions or the underlying data. To move an application to another Oracle Application Express instance, you must export the application definition from your development server and import it into your production server.

Topics in this section include:

Export the Application Definition

Create the Required Objects to Support the Application

Import the Application Definition into the Production Instance

Load the Data

Export the Application Definition

To export the application definition from your development server:

On the Workspace home page, click the arrow on the Application Builder icon and select the application you just created.

Click the Export/Import icon.

For Export/Import, click Export and then Next.

For Application, make sure the application created in this exercise is selected.

Click Export Application.

When prompted, click to Save the file.

Specify a location on your local hard drive and click Save.

Create the Required Objects to Support the Application

On your production instance, you need to create the objects necessary to support the application. Log in to the production instance and follow the directions in "Designing the Database Objects".

Note:

Although the supporting objects do not need to exist for you to import the application definition, be aware you cannot test the code until they exist.

Import the Application Definition into the Production Instance

Log in to the production instance of the Workspace home page:

On the Workspace home page, click the arrow on the Application Builder icon and select the application you just created.

On the Application home page, click Export/Import.

On the Export/Import page, click Import and click Next.

For Import File:

Import file - Click the Browse button and locate your exported file.

File Type - Select Application, Page, or Component Export.

File Character Set - Accept the default and click Next.

Once the success message appears, the next step is to install the file.

Click Next.

On Application Install:

Parsing Schema - Select the schema on your production server that contains your application objects.

Build Status - Select Run and Build Application.

This option enables other users to run the application and enables you to log in and change the code if necessary. Alternatively, you can select Run Application Only. Be aware that if you select this option you will not be able to access the source code for the application.

Install As Application - You can select:

Reuse Application ID from Export File - Only select this option if the application ID is not being used on the production instance.

Auto Assign New Application ID - Select this option to assign a new application ID.

Change Application ID - Select this option to change the existing application ID. If you select this option, you will be prompted to enter a new application ID.

When you install an application having the same ID as an existing application in the current workspace, the existing application is deleted and then the new application is installed. If you attempt to install an application having the same ID as an existing application in a different workspace, an error message appears.

If all statements are successful the install commits and becomes permanent. If any errors are encountered, the install is rolled back, resulting in no permanent changes.

Click Install.

If the install is successful, the Post-App Install Utility Options page appears. From here, you can select one of the following:

Select Run Application to see the application running

Select Application Attributes to view the application definition within Application Builder

Load the Data

The next step in deploying your application is to load the data. At a minimum, you would need to populate the project and people tables.

Note there are various mechanisms you could use to accomplish this task, including:

Use the application itself to create data.

Use the Data Loader to load data copied from a spreadsheet.

Use SQL Scripts and run scripts to create data.

If you have data existing already within an Oracle database, use either export/import to move data between machines or use SQL to retrieve and transform existing data and load it into the application tables.

See Also:

"Loading Demonstration Data" and "Importing, Exporting, Loading, and Unloading Data" in Oracle Database Express Edition 2 Day DBA

Alternate Authentication Mechanisms to Consider

When the application login page calls the login API with a user name and password, the Application Express engine calls the credentials verification method specified in the application's current authentication scheme. You have three choices as to how credentials are verified from within the login API:

Implement the method yourself as a PL/SQL function returning Boolean and put it in your application's schema.

Use the built-in LDAP authentication method, which checks user name and password against the LDAP directory that you specify.

Use the built-in Oracle Application Express authentication method, which checks the user name and password against the Oracle Application Express workspace repository.

Your application is currently using the built-in Oracle Application Express authentication method.

See Also:

"Establishing User Identity Through Authentication" in Oracle Database Application Express User's Guide

See Also:

Security How To documents on OTN:

http://www.oracle.com/technology/products/database/application_express/howtos/howtos.html

Create Users

In order for your application to be accessible, you need to create users. If you are still using Oracle Application Express authentication, the simplest way to create users it to access the Manage Users page.

To create a new user:

Go to the Workspace home page.

From the Administration list on the right side of the page, click Manage Application Express Users.

From the Tasks list on the right side of the page, click Create End User.

Under User Identification, enter the required information.

Click Create User or Create and Create Another.

Publish the URL

Now that you have deployed your application, loaded data, and created users, you can publish your production URL.

You can determine the URL to your application by positioning the mouse over the Run icon on the Application home page. The URL appears in the status bar at the bottom of the page.

The Run icon gets its value from the Home link attribute on the Edit Security Attributes page. This link is only referenced by this icon and by applications that do not use the Oracle Application Express Login API. Consider the following example:

http://apex.oracle.com/pls/otn/f?p=11563:1:3397731373043366363

Where:

apex.oracle.com is the URL of the server

pls is the indicator to use the mod_plsql cartridge

otn is the data access descriptor (DAD) name

f?p= is a prefix used by Oracle Application Express

11563 is the application being called

Instead of hard coding this ID as shown here, you could use the substitution string APP_ALIAS.

1 is the page within the application to be displayed

3397731373043366363 is the session number

To run this example application, you would use the URL:

http://apex.oracle.com/pls/otn/f?p=11563:1

When users log in, they receive a unique session number.

As you may recall, you created the Issue Tracker application using the Create Application wizard. This wizard creates a process on the Login page (page 101) that controls authentication. The contents of the process are:

WWV_FLOW_CUSTOM_AUTH_STD.LOGIN(
    P_UNAME => :P101_USERNAME,
    P_PASSWORD => :P101_PASSWORD,
    P_SESSION_ID => :FLOW_SESSION,
    P_FLOW_PAGE => :APP_ID||':1'
    );

Note that the Page is hard coded into this process. Because of this, the page you pass in to the URL is overwritten and does not need to be included. You can access the application by using the following URL:

http://apex.oracle.com/pls/otn/f?p=11563

As you can see from the example used, the URL has no meaning and can be rather long. The host name can be changed to make it more symbolic. You can also configure Apache to rewrite your URL so that you can publish an abbreviated format and a URL that would be more intuitive to your users. See your Apache documentation for details.

A DDLs and Scripts

This appendix contains DDLs (data definition language) and scripts necessary to complete a number of tutorials in Oracle Application Express Advanced Tutorials.

Topics in this section include:

Creating Application Database Objects DDL

Creating Issues Script

Creating Application Database Objects DDL

The following DDL creates all the required database objects used by the Issue Tracking application. The Issue Tracking application is described in Chapter 14, "How to Design an Issue Tracking Application" and Chapter 15, "How to Build and Deploy an Issue Tracking Application".

--
-- IT_API package spec
--
create or replace package it_api
as
function gen_pk
return number;
end it_api;
/
--
-- IT_PROJECTS
--
-- The IT_PROJECTS DDL:
-- + creates the projects table with the necessary columns,
-- including a new column for a system generated primary key
-- + declares the new primary key
-- + implements the real primary key, project name, as a unique key
-- + populates the project id whenever a new record is created
-- + sets the auditing columns
-- + declares table and column comments
--
create table it_projects (
project_id number not null,
project_name varchar2(255) not null,
start_date date not null,
target_end_date date not null,
actual_end_date date,
created_on date not null,
created_by varchar2(255) not null,
modified_on date,
modified_by varchar2(255)
)
/
alter table it_projects
add constraint it_projects_pk
primary key (project_id)
/
alter table it_projects
add constraint it_projects_uk
unique (project_name)
/
create or replace trigger it_projects_biu
before insert or update on it_projects
for each row
begin
if inserting then
if :NEW.PROJECT_ID is null then
:NEW.PROJECT_ID := it_api.gen_pk;
end if;
:NEW.CREATED_ON := sysdate;
:NEW.CREATED_BY := nvl(v('APP_USER'),USER);
end if;
if updating then
:NEW.MODIFIED_ON := sysdate;
:NEW.MODIFIED_BY := nvl(v('APP_USER'),USER);
end if;
end;
/
comment on table it_projects is
'All projects currently underway.'
/
comment on column it_projects.project_id is
'The system generated unique identifier for the project.'
/
comment on column it_projects.project_name is
'The unique name of the project.'
/
comment on column it_projects.start_date is
'The start date of the project.'
/
comment on column it_projects.target_end_date is
'The targeted end date of the project.'
/
comment on column it_projects.actual_end_date is
'The actual end date of the project.'
/
comment on column it_projects.created_on is
'Audit Column: Date the record was created.'
/
comment on column it_projects.created_by is
'Audit Column: The user who created the record.'
/
comment on column it_projects.modified_on is
'Audit Column: Date the record was last modified.'
/
comment on column it_projects.modified_by is
'Audit Column: The user who last modified the record.'
/
--
-- IT_PEOPLE
--
-- The IT_PEOPLE DDL:
-- + creates the people table with the necessary columns,
-- including a new column for a system generated primary key
-- + declares the new primary key
-- + implements the real primary key, person name, as a unique key
-- + implements a check constraint to validate the roles that people
-- can be assigned
-- + implements a foreign key to validate that people are assigned to
-- valid projects
-- + implements a check constraint to enforce that all project leads
-- and team members are assigned to projects
-- + populates the person id whenever a new record is created
-- + sets the auditing columns
-- + declares table and column comments
--
create table it_people (
person_id number not null,
person_name varchar2(255) not null,
person_email varchar2(255) not null,
person_role varchar2(30) not null,
username varchar2(255) not null,
assigned_project number,
created_on date not null,
created_by varchar2(255) not null,
modified_on date,
modified_by varchar2(255)
)
/
alter table it_people
add constraint it_people_pk
primary key (person_id)
/
alter table it_people
add constraint it_people_name_uk
unique (person_name)
/
alter table it_people
add constraint it_people_username_uk
unique (username)
/
alter table it_people
add constraint it_people_role_cc
check (person_role in ('CEO','Manager','Lead','Member'))
/
alter table it_people
add constraint it_people_project_fk
foreign key (assigned_project)
references it_projects
/
alter table it_people
add constraint it_people_assignment_cc
check ( (person_role in ('Lead','Member') and assigned_project is not null) or
(person_role in ('CEO','Manager') and assigned_project is null) )
/
create or replace trigger it_people_biu
before insert or update on it_people
for each row
begin
if inserting then
if :NEW.PERSON_ID is null then
:NEW.PERSON_ID := it_api.gen_pk;
end if;
:NEW.CREATED_ON := sysdate;
:NEW.CREATED_BY := nvl(v('APP_USER'),USER);
end if;
if updating then
:NEW.MODIFIED_ON := sysdate;
:NEW.MODIFIED_BY := nvl(v('APP_USER'),USER);
end if;
end;
/
comment on table it_people is
'All people within the company.'
/
comment on column it_people.person_id is
'The system generated unique identifier for the person.'
/
comment on column it_people.person_name is
'The unique name of the person.'
/
comment on column it_people.person_role is
'The role the person plays within the company.'
/
comment on column it_people.username is
'The username of this person. Used to link login to person details.'
/
comment on column it_people.assigned_project is
'The project that the person is currently assigned to.'
/
comment on column it_people.created_on is
'Audit Column: Date the record was created.'
/
comment on column it_people.created_by is
'Audit Column: The user who created the record.'
/
comment on column it_people.modified_on is
'Audit Column: Date the record was last modified.'
/
comment on column it_people.modified_by is
'Audit Column: The user who last modified the record.'
/
--
-- IT_ISSUES
--
-- The IT_ISSUES DDL:
-- + creates the table with the necessary columns, including a new column
-- for a system generated primary key
-- + declares the new primary key
-- + implements a foreign key to validate that the issue is identified by a
-- valid person
-- + implements a foreign key to validate that the issue is assigned to a
-- valid person
-- + implements a foreign key to validate that the issue is associated with
-- a valid project
-- + implements a check constraint to validate the status that is assigned
-- to the issue
-- + implements a check constraint to validate the priority that is assigned
-- to the issue
-- + populates the issue id whenever a new record is created
-- + sets the auditing columns
-- + assigns the status of 'Open' if no status is provided
-- + sets the status to 'Closed' if an ACTUAL_RESOLUTION_DATE is provided
-- + declares table and column comments
--
create table it_issues (
issue_id number not null,
issue_summary varchar2(255) not null,
issue_description varchar2(4000),
identified_by_person_id number not null,
identified_date date not null,
related_project_id number not null,
assigned_to_person_id number,
status varchar2(30) not null,
priority varchar2(30) not null,
target_resolution_date date,
progress varchar2(4000),
actual_resolution_date date,
resolution_summary varchar2(4000),
created_on date not null,
created_by varchar2(255) not null,
modified_on date,
modified_by varchar2(255)
)
/
alter table it_issues
add constraint it_issues_pk
primary key (issue_id)
/
alter table it_issues
add constraint it_issues_identified_by_fk
foreign key (identified_by_person_id)
references it_people
/
alter table it_issues
add constraint it_issues_assigned_to_fk
foreign key (assigned_to_person_id)
references it_people
/
alter table it_issues
add constraint it_issues_project_fk
foreign key (related_project_id)
references it_projects
/
alter table it_issues
add constraint it_issues_status_cc
check (status in ('Open','On-Hold','Closed'))
/
alter table it_issues
add constraint it_issues_priority_cc
check (priority in ('High','Medium','Low'))
/
create or replace trigger it_issues_biu
before insert or update on it_issues
for each row
begin
if inserting then
if :NEW.ISSUE_ID is null then
:NEW.ISSUE_ID := it_api.gen_pk;
end if;
:NEW.CREATED_ON := sysdate;
:NEW.CREATED_BY := nvl(v('APP_USER'),USER);
if :new.status is null
then :new.status := 'Open';
end if;
end if;
if updating then
:NEW.MODIFIED_ON := sysdate;
:NEW.MODIFIED_BY := nvl(v('APP_USER'),USER);
if :new.actual_resolution_date is not null
then :new.status := 'Closed';
end if;
end if;
end;
/
comment on table it_issues is
'All issues related to the projects being undertaken by the company.'
/
comment on column it_issues.issue_id is
'The system generated unique identifier for the issue.'
/
comment on column it_issues.issue_summary is
'A brief summary of the issue.'
/
comment on column it_issues.issue_description is
'A full description of the issue.'
/
comment on column it_issues.identified_by_person_id is
'The person who identified the issue.'
/
comment on column it_issues.identified_date is
'The date the issue was identified.'
/
comment on column it_issues.related_project_id is
'The project that the issue is related to.'
/
comment on column it_issues.assigned_to_person_id is
'The person that the issue is assigned to.'
/
comment on column it_issues.status is
'The current status of the issue.'
/
comment on column it_issues.priority is
'The priority of the issue. How important it is to get resolved.'
/
comment on column it_issues.target_resolution_date is
'The date on which the issue is planned to be resolved.'
/
comment on column it_issues.actual_resolution_date is
'The date the issue was actually resolved.'
/
comment on column it_issues.progress is
'Any progress notes on the issue resolution.'
/
comment on column it_issues.resolution_summary is
'The description of the resolution of the issue.'
/
comment on column it_issues.created_on is
'Audit Column: Date the record was created.'
/
comment on column it_issues.created_by is
'Audit Column: The user who created the record.'
/
comment on column it_issues.modified_on is
'Audit Column: Date the record was last modified.'
/
comment on column it_issues.modified_by is
'Audit Column: The user who last modified the record.'
/
--
-- IT_API package body
--
create or replace package body it_api
as
-- generates and returns unique number used for primary key values
function gen_pk
return number
is
l_pk number := 0;
begin
for c1 in (
select to_number(sys_guid(),'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') pk
from dual )
loop
l_pk := c1.pk;
exit;
end loop;
return l_pk;
end gen_pk;
end it_api;
/

Creating Issues Script

The following script populates the Issues table for the Issue Tracking application described in Chapter 14, "How to Design an Issue Tracking Application".

create or replace package it_sample_data
as
procedure create_sample_projects;
procedure create_sample_people;
procedure create_sample_issues;
procedure remove_sample_data;
end it_sample_data;
/
create or replace package body it_sample_data
as
procedure create_sample_projects
is
begin
insert into it_projects (project_id, project_name, start_date, target_end_date)
values (1, 'Internal Infrastructure', sysdate-150, sysdate-30);
insert into it_projects (project_id, project_name, start_date, target_end_date)
values (2, 'New Payroll Rollout', sysdate-150, sysdate+15);
insert into it_projects (project_id, project_name, start_date, target_end_date)
values (3, 'Email Integration', sysdate-120, sysdate-60);
insert into it_projects (project_id, project_name, start_date, target_end_date)
values (4, 'Public Website Operational', sysdate-60, sysdate+30);
insert into it_projects (project_id, project_name, start_date, target_end_date)
values (5, 'Employee Satisfaction Survey', sysdate-30, sysdate+60);
commit;
end create_sample_projects;
procedure create_sample_people
is
begin
insert into it_people (person_id, person_name, person_email, person_role, username, assigned_project)
values (1, 'Joe Cerno', 'joe.cerno@mrvl-bademail.com', 'CEO', 'jcerno', null);
insert into it_people (person_id, person_name, person_email, person_role, username, assigned_project)
values (2, 'Kim Roberts', 'kim.roberts@mrvl-bademail.com', 'Manager', 'kroberts', null);
insert into it_people (person_id, person_name, person_email, person_role, username, assigned_project)
values (3, 'Tom Suess', 'tom.suess@mrvl-bademail.com', 'Manager', 'tsuess', null);
insert into it_people (person_id, person_name, person_email, person_role, username, assigned_project)
values (4, 'Al Bines', 'al.bines@mrvl-bademail.com', 'Lead', 'abines', 1);
insert into it_people (person_id, person_name, person_email, person_role, username, assigned_project)
values (5, 'Carla Downing', 'carla.downing@mrvl-bademail.com', 'Lead', 'cdowning', 2);
insert into it_people (person_id, person_name, person_email, person_role, username, assigned_project)
values (6, 'Evan Fanner', 'evan.fanner@mrvl-bademail.com', 'Lead', 'efanner', 3);
insert into it_people (person_id, person_name, person_email, person_role, username, assigned_project)
values (7, 'George Hurst', 'george.hurst@mrvl-bademail.com', 'Lead', 'ghurst', 4);
insert into it_people (person_id, person_name, person_email, person_role, username, assigned_project)
values (8, 'Irene Jones', 'irene.jones@mrvl-bademail.com', 'Lead', 'ijones', 5);
insert into it_people (person_id, person_name, person_email, person_role, username, assigned_project)
values (9, 'Karen London', 'karen.london@mrvl-bademail.com', 'Member', 'klondon', 1);
insert into it_people (person_id, person_name, person_email, person_role, username, assigned_project)
values (10, 'Mark Nile', 'mark.nile@mrvl-bademail.com', 'Member', 'mnile', 1);
insert into it_people (person_id, person_name, person_email, person_role, username, assigned_project)
values (11, 'Jane Kerry', 'jane.kerry@mrvl-bademail.com', 'Member', 'jkerry', 5);
insert into it_people (person_id, person_name, person_email, person_role, username, assigned_project)
values (12, 'Olive Pope', 'olive.pope@mrvl-bademail.com', 'Member','opope', 2);
insert into it_people (person_id, person_name, person_email, person_role, username, assigned_project)
values (13, 'Russ Sanders', 'russ.sanders@mrvl-bademail.com', 'Member', 'rsanders', 3);
insert into it_people (person_id, person_name, person_email, person_role, username, assigned_project)
values (14, 'Tucker Uberton', 'tucker.uberton@mrvl-bademail.com', 'Member', 'ruberton', 3);
insert into it_people (person_id, person_name, person_email, person_role, username, assigned_project)
values (15, 'Vicky Williams', 'vicky.willaims@mrvl-bademail.com', 'Member', 'vwilliams', 4);
insert into it_people (person_id, person_name, person_email, person_role, username, assigned_project)
values (16, 'Scott Tiger', 'scott.tiger@mrvl-bademail.com', 'Member', 'stiger', 4);
insert into it_people (person_id, person_name, person_email, person_role, username, assigned_project)
values (17, 'Yvonne Zeiring', 'yvonee.zeiring@mrvl-bademail.com', 'Member', 'yzeirling', 4);
commit;
end create_sample_people;
procedure create_sample_issues
is
begin
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(1, 'Midwest call center servers have no failover due to Conn Creek plant fire','',
6, sysdate-80,
3, 6, 'Closed', 'Medium', sysdate-73,
'Making steady progress.', sysdate-73, '');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(2, 'Timezone ambiguity in some EMEA regions is delaying bulk forwarding to mirror sites','',
6, sysdate-100,
3, 14, 'Open', 'Low', sysdate-80,
'','','');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(3, 'Some vendor proposals lack selective archiving and region-keyed retrieval sections','',
6, sysdate-110,
3, 13, 'Closed', 'Medium', sysdate-90,
'', sysdate-95, '');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(4, 'Client software licenses expire for Bangalore call center before cutover','',
1, sysdate-70,
3, 6, 'Closed', 'High', sysdate-60,
'',sysdate-66,'Worked with HW, applied patch set.');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(5, 'Holiday coverage for DC1 and DC3 not allowed under union contract, per acting steward at branch 745','',
1, sysdate-100,
3, 13, 'Closed', 'High', sysdate-90,
'',sysdate-95, 'Worked with HW, applied patch set.');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(6, 'Review rollout schedule with HR VPs/Directors','',
8, sysdate-30,
5, null, 'Closed', 'Medium', sysdate-15,
'',sysdate-20,'');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(7, 'Distribute translated categories and questions for non-English regions to regional team leads','',
8, sysdate-2,
5, 8, 'Open', 'Medium', sysdate+10,
'currently beta testing new look and feel','','');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(8, 'Provide survey FAQs to online newsletter group','',
1, sysdate-10,
5, 11, 'Open', 'Medium', sysdate+20,
'','','');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(9, 'Need better definition of terms like work group, department, and organization for categories F, H, and M-W','',
1, sysdate-8,
5, null, 'Open', 'Low', sysdate+15,
'','','');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(10, 'Legal has asked for better definitions on healthcare categories for Canadian provincial regs compliance','',
1, sysdate-10,
5, 11, 'Closed', 'Medium', sysdate+20,
'',sysdate-1,'');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(11, 'Action plan review dates conflict with effectivity of organizational consolidations for Great Lakes region','',
1, sysdate-9,
5, 11, 'Open', 'Medium', sysdate+45,
'','','');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(12, 'Survey administration consulting firm requires indemnification release letter from HR SVP','',
1, sysdate-30,
5, 11, 'Closed', 'Low', sysdate-15,
'', sysdate-17, '');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(13, 'Facilities, Safety health-check reports must be signed off before capital asset justification can be approved','',
4, sysdate-145,
1, 4, 'Closed', 'Medium', sysdate-100,
'',sysdate-110,'');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(14, 'Cooling and Power requirements exceed 90% headroom limit -- variance from Corporate requested','',
4, sysdate-45,
1, 9, 'Closed', 'High', sysdate-30,
'',sysdate-35,'');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(15, 'Local regulations prevent Federal contracts compliance on section 3567.106B','',
4, sysdate-90,
1, 10, 'Closed', 'High', sysdate-82,
'',sysdate-85,'');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(16, 'Emergency Response plan failed county inspector''s review at buildings 2 and 5','',
4, sysdate-35,
1, null, 'Open', 'High', sysdate-5,
'','','');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(17, 'Training for call center 1st and 2nd lines must be staggered across shifts','',
5, sysdate-8,
2, 5, 'Closed', 'Medium', sysdate+10,
'',sysdate-1,'');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(18, 'Semi-monthly ISIS feed exceeds bandwidth of Mississauga backup site','',
5, sysdate-100,
2, 12, 'On-Hold', 'Medium', sysdate-30,
'pending info from supplier','','');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(19, 'Expat exception reports must be hand-reconciled until auto-post phaseout complete','',
5, sysdate-17,
2, 12, 'Closed', 'High', sysdate+4,
'',sysdate-4,'');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(20, 'Multi-region batch trial run schedule and staffing plan due to directors by end of phase review','',
5, sysdate,
2, null, 'Open', 'High', sysdate+15,
'','','');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(21, 'Auditors'' signoff requires full CSB compliance report','',
5, sysdate-21,
2, 5, 'Open', 'High', sysdate-7,
'','','');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(22, 'Review security architecture plan with consultant','',
1, sysdate-60,
4, 7, 'Closed', 'High', sysdate-45,
'',sysdate-40,'');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(23, 'Evaluate vendor load balancing proposals against capital budget','',
7, sysdate-50,
4, 7, 'Closed', 'High', sysdate-45,
'',sysdate-43,'');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(24, 'Some preferred domain names are unavailable in registry','',
7, sysdate-55,
4, 15, 'Closed', 'Medium', sysdate-45,
'',sysdate-50,'');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(25, 'Establish grid management capacity-expansion policies with ASP','',
7, sysdate-20,
4, 16, 'Open', 'Medium', sysdate-5,
'','','');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(26, 'Access through proxy servers blocks some usage tracking tools','',
7, sysdate-10,
4, 15, 'Closed', 'High', sysdate-5,
'',sysdate-1,'');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(27, 'Phase I stress testing cannot use production network','',
7, sysdate-11,
4, 17, 'Open', 'High', sysdate,
'','','');
insert into it_issues
(issue_id, issue_summary, issue_description,
identified_by_person_id, identified_date,
related_project_id, assigned_to_person_id, status, priority,
target_resolution_date, progress,
actual_resolution_date, resolution_summary)
values
(28, 'DoD clients must have secure port and must be blocked from others','',
7, sysdate-20,
4, 17, 'On-Hold', 'High', sysdate,
'Waiting on Security Consultant, this may drag on.','','');
commit;
end create_sample_issues;
procedure remove_sample_data
is
begin
delete from it_issues where issue_id < 29;
delete from it_people where person_id < 18;
delete from it_projects where project_id < 6;
commit;
end remove_sample_data;
end it_sample_data;
/

This illustration shows the Templates and Theme sections on the right side of the Page Definition. Additional information about this illustration can be found in the surrounding text.

This illustration shows the Mdf Pdf Orders report. The report contains five rows and a Create button displays in the upper right corner. Each row contains an Edit icon. To edit an order and view the master detail form, click the Edit icon.

This illustration shows the revised Master Detail page. The top of the page contains four button (Cancel, Delete, Apply Changes, and Print PDF or Order) that enable you to update order information. Available fields include Order Date, Order Mode, Order Status, Customer Name, Sales Rep, and Order Total. The bottom of the page lists specific item details including Line Item Id, Quantity, Product Name, and Unit Price and three corresponding buttons Delete, Apply Changes, and Add Row.

This illustration shows the revised update form. Note that P2_SET_MIN_PRICE now displays as a check box.

This illustration shows the Telecommute field changed to a check box.

This illustration shows the revised Issue report. Additional information about this illustration can be found in the surrounding text.

This illustration shows the Stop and start table icon in the Item palette and the associated tooltip. Additional information about this illustration can be found in the surrounding text.

This illustration shows the Employee Info form with P900_EMP_PART_OR_FULL_TIME changed to a radio group. Additional information about this illustration can be found in the surrounding text.

This illustration shows a tabular form with the Department Id column changed to a select list. Additional information about this illustration can be found in the surrounding text.

This illustration shows two links in the Navigation section: Issues and Dashboard.

This illustration shows the IT_PEOPLE Table when displayed from the Application Expresss Object Browser.

This illustration shows the Issues report with all columns included. See surrounding text for further information.

This illustration shows the Application home page for the Parameterized Reports application. The Create Application Wizard created a Home page, Issues report page, Issue Details form page and a Login page. See surrounding text for further details.

This illustration shows an interactive report that queries the IT_PEOPLE table for data. The developer used the Create Page Wizard to add this page to an application. See surrounding text for further details.

This illustration shows the Average Days to Resolve report. It shows a person's name followed by a bar representing the average days to resolve. To the right of each bar is the number represented by the bar.

This illustration shows the revised Home page. A list of horizontal images is displayed along with a link to the Dashboard, Projects, Issues, Reports and Users pages.

This illustration shows the Script Editor page. The top of the page includes the button Cancel, Edit Using Text Area, and Apply Changes. You can toggle between the current page and a text page, by clicking the Edit Using Text Area button. To save your changes, click Apply Changes. The actual editor also contains the buttons Undo, Redo, and Find.

This illustration shows the running form. When you position the cursor in the Last Name field and click Create, a message appears. Additional information about this illustration can be found in the surrounding text.

This illustration shows the Create icon that displays in each section of the Page Definition. The Create icon resembles a plus (+) sign that overlaps a small page. Click the Create icon to create a new control or component.

This illustration shows the Details view on the Manage Script Results page. Additional information about this illustration can be found in the surrounding text.

This illustration shows the revised User page. In the new report, the Create button now reads Add User and the Assigned Project is the name of the project rather than the Project ID.

This illustration shows the IT_PROJECTS Table when displayed from the Application Expresss Object Browser.

This illustration displays a completed form with DEPARTMENT_ID changed to a select list. Additional information about this illustration can be found in the surrounding text.

This illustrates the Issue Details page. This issue was identified by Joe Cerno and has not been assigned to anyone yet.

This illustration shows the completed stacked bar chart. A legend that defines the color associated with each product appears at the top of the page. The chart displays the sum by product category for sales. Additional information about this illustration can be found in the surrounding text.

This illustration shows the DEL column on the Report Column Attributes page after it has been moved below PRODUCT_ID.

This illustration shows the Audit Information region with the footer. The text of the footer is wrapped in the italic HTML tag and contains an embedded break. Without the manual break, the text would take up the entire width of the region. Additional information about this illustration can be found in the surrounding text.

This illustration shows Object Browser. A list of objects appears on the left side of the page. To find a specific object, select its object type at the top of the page. For example, to view tables, select Tables. Additional information about this graphic can be found in the surrounding text.

This illustration shows the list of columns displayed and the 3 columns not being displayed.

This illustration shows an interactive report with the Search Bar, Report Settings, Link Column, Actions Menu and Column Heading Menu clearly identified. See surrounding text for further information.

This illustration is an overview of the Issue Tracker User Interface. All 15 pages that comprise the user interface are shown in this overview. After logging in, the Home page is displayed. From this page the user can navigate to the Dashboard page, Projects pages, Issues pages, Reports pages and User pages.

This illustration shows the Projects page listing all projects in the database.

This illustrates the body of an email sent as a result of a new issue being assigned. The new issue is for the Internal Infrastructure project, has an open status and is high in priority.

This illustration shows an empty User Information page. When creating a new User, this page starts off being empty.

This illustration shows the ACL_EMPLOYEES application built on the ACL_EMPLOYEES table. Additional information about this illustration can be found in the surrounding text.

This illustration shows the Employee Info form after editing the Prompt, New Line, and Width attributes. Additional information about this illustration can be found in the surrounding text.

This illustrates the Dashboard with the added Open Issues by Project report region. See surrounding text for further details.

This illustration shows the Script Properties page. The first section, Script, contains the Name and Sequence fields for you to edit. It also displays the Script Type. In the second section, Conditions, you can select the Condition Type from a drop-down list and add text in the Expression 1 and Expression 2 text areas.

This illustration shows the breadcrumb menu on the Page Definition. Click Home to return to the Workspace home page. Additional information about this illustration can be found in the surrounding text.

This illustration shows the Home page. At this point in the tutorial, the only navigation link is the Issues report link. See surrounding text for further details.

This illustration shows the Users page. A list of all users provisioned for this application along with general user information is displayed on this page.

This illustration shows the Employee Info form with a new display point and template applied. Additional information about this illustration can be found in the surrounding text.

This illustration shows what your development environment should look like after creating all the Issue Tracker application pages.

This illustration shows the Issue Details page being run by a person for whom authorization fails. Note a new region displays at the top of the page that displays the message, "You are not authorized to modify the data for this issue because you are not the Project Lead nor is the issue assigned to you." Additionally, only a Cancel button appears.

This illustration shows the Project Details page after the user has selected the Add Project button on the Projects page. Fields on the form are empty when a project is being added. Additional information about this illustration can be found in the surrounding text.

This illustration shows the Issue Details page. This page is shown when a new issue is added to the system or when issue details for an existing issue are edited or viewed.

This illustration shows the Installation, Upgrade, Messages sections on the Supporting Objects page. Additional information about this illustration can be found in the surrounding text.

This illustration shows the Edit All icon. The Edit All icon resembles a small grid with a pencil on top of it.

This illustration shows the selection of the Actions menu icon to the right of the Go button. See surrounding text for further information.

This illustration shows a running tabular form on the OEHR_EMPLOYEES table. The tabular form contains four buttons. Cancel, Delete, and Apply Changes display in the upper right corner and Add Row displays at the bottom. Additionally, a check box appears to the left of each row enabling the user to select one row at a time. Alternatively, users can select all rows at once by selecting the check box to the left of the column headings. Additional information about this illustration can be found in the surrounding text.

This illustrates how the Issue Details page looks after grouping items into the Issue Details, Progress, and Resolution regions.

This illustration shows the Edit page attributes icon. This icon resembles a small page with a pencil on top of it.

This illustration shows the newly created pages in the Create Application Wizard. You can edit the Page Definition by clicking the page name. Additional information about this illustration can be found in the surrounding text.

This illustration shows the Validation page. This page contains the following attributes: Name, Sequence, Type, Expression 1, and Expression 2.

This illustration shows the Edit Substitutions page. In this example the two substitution strings appear, TEST and TEST2, the current value, and a Prompt Text field. If you wanted the prompts to appear for a substitution strings during installation, select the substitution string and enter the appropriate text in the Prompt Field.

This illustration shows the application Home page with a navigation link to the Issues report. See surrounding text for further information.

This illustration shows the user making a selection from the Dashboard pie chart region. The user has selected all open issues for the Employee Satisfaction Survey project. See surrounding text for further details.

This illustration shows the Employees report when logged in with Administrator privileges. Both the Edit icon and the Administrator tab appear. Additional information about this illustration can be found in the surrounding text.

This illustration shows the Report link adjacent to the Upload Files. Click this link to access the Report Attributes page. Additional information about this illustration can be found in the surrounding text.

This illustration shows the Employees report when logged in with View privileges. Additional information about this illustration can be found in the surrounding text.

This illustration shows the Installation Scripts page. It lists the nine scripts defined with OEHR Sample Objects. The list consists of these columns: Name, Sequence, and Script. An Edit icon appears in each row. At the top are Cancel and Create buttons along with arrows to move forward or back through the list.

This illustration shows the Issue Details page after the items have been renamed and before they are grouped into separate logical categories.

This illustration shows the Page Name link at the top of the Create Application Wizard. Clicking this links displays the Page Definition.

This illustration shows what the Copy button icon looks like.

This illustration shows the Issues report. See surrounding text for further details.

This illustration shows the Drag and Drop Layout page for page 2 in the Form Layout application. The page is divided into two sections. The Item palette on the left is where you select the item to add to the region. The Layout region on the right displays the current page layout. To add new items, you drag items from the palette and drop them at the appropriate location in the region.

This illustration shows the Application Builder Developer toolbar. Additional information about this graphic appears in the surrounding text. The Developer toolbar consists of the following links:

Home links you to the Workspace home page.

Application links you to the Application home page.

Edit Page accesses the Page Definition for the current running page.

Create links to a wizard for creating a new page, region, page control (item, button, branch, computation, process, or validation), or a shared control (navigation bar icon, tab, list of values, list, or breadcrumb).

Session displays a new window containing session state information for the current page.

Activity links you to the Activity reports page.

Debug toggles the page between Debug and No Debug mode.

Show Edit Links toggles between Show Edit Links and Hide Edit Links. Clicking Show Edit Links displays edit links next to each object on the page that can be edited.

This illustration shows the Master Details page. The top of the page contains three buttons (Cancel, Delete, and Apply Changes) that enable you to update order information. Available fields include Order Date, Order Mode, Order Status, Customer Name, Sales Rep, and Order Total. The bottom of the page lists specific item details including Line Item Id, Quantity, Product Name, and Unit Price and three corresponding buttons Delete, Apply Changes, and Add Row (now shown).

This illustration shows the Select Columns options. The Do Not Display box lists all the columns not included in the report display. The Display in Report box lists all columns included in the report display. See surrounding text for further details.

This illustration shows the Issue Details form. This revised form has a new button, Create and Create Another. This button enables users to add multiple issues sequentially. Additional information about this illustration can be found in the surrounding text.

This illustration shows the Issue Summary by Project Report. The report includes the number of issues for each priority and status. Another region on the report displays the Assignments by Status information for the selected project. Additional information about this illustration can be found in the surrounding text.

This illustration shows the Working Report tab and Report 1 tab at the top of the Issues Report page. See surrounding text for more information.

This illustration shows a classic report. The customization features that are by default generated for interactive reports are not generated for classic reports. See surrounding text for further details.

This illustration shows a form for uploading documents. The form shows the heading Submit File. Under that is a File Name field with a Browse button to the right. Additional information about this illustration can be found in the surrounding text.

This illustration shows the PROJECTS, ISSUES, and PEOPLE database tables used by the Issue Tracker application. Refer to surounding text for further information.

This illustrates the Reports page. Similar to the home page, this page also displays a horizontal list of images.

This illustration shows the Search Bar with the Assigned To column added to the search criteria. See surrounding text for further details.

This illustration shows the Deinstallation section on the Supporting Objects page. Additional information about this graphic can be found in the surrounding text.

This illustration shows the Create/Edit Web Service page with the fields filled out according to the instructions in these steps.

This illustration shows the new Uploaded Files report. The report displays two columns, ID and Name. Additional information about this illustration can be found in the surrounding text.

This illustration shows the newly created Users page. The appearance of this page has not yet been refined.

This illustration shows the initial Issues Report page, before any query modifications. This report displays all issues and includes a Link Column icon to the left of each row. See surrounding text for further details.

The application home page displays a horizontal list of images. The Projects link is now active and will allow you to navigate to the Projects page.

This illustration shows the Employee Info form after with the corrected item alignment. Note that inserting the Stop and Start HTML Table item corrected the layout. Additional information about this illustration can be found in the surrounding text.

This illustration shows the Movie Information form you created to use when locating movie information near a specific zip code. The top part contains the label Movie Information, two empty text fields (ZIP Code and Radius), and a Submit button. The bottom part contains the label Search Results with the text underneath: no data found.

This illustration shows all the items on the Issue Details page alligned properly.

This illustration shows the Column Attributes section of the Report Attributes page. Additional information about this illustration can be found in the surrounding text.

This illustrates the Overdue Issues report on the Dashboard. Any issues that have a target resolution date in the past and the status is not closed are included in this report. See surrounding text for further details.

This illustrates the Overdue Issues report on the Dashboard. Any issues that have a target resolution date in the past and the status is not closed will be included in this report.

This illustration shows the Run Application icon. The Run Application icon resembles a traffic light. Click this icon to submit the pages in the current application to the Application Express engine to render viewable HTML.

This illustration shows the Update Form. Note that the form contains nine fields and three buttons (Cancel, Delete, and Apply Changes).

This illustration shows the Select Columns icon being selected on the Search Bar. The list of report columns appears. See surrounding text for further details.

This illustrates the Dashboard page. The Dashboard includes reports for overdue issues, recently opened issues, unassigned issues and open issues by project.

This illustration shows the Select Columns options page. Columns included in the display are listed in the Display in Report box. The columns not included in the display are listed in the Do Not Display box. See surrounding text for further details.

This illustration shows the Supporting Objects page. You can use the Supporting Objects Utility to define the database object definitions, images, and seed data to be included in your application export. Additional information about this illustration can be found in the surrounding text.

This illustration shows the Issue Details form for the first issue on the Issues report page. See surrounding text for further information.

This illustration shows the Theater Information Form and Report. The form contains data entry fields for ZIP Code and Radius as well as a Submit button. At this point, the Results form does not contain any data.

This illustration shows the User Information for Al Bines. The appearance of this page has not yet been refined.

This illustration shows the Part and Full-time radiogroup changed to display side by side. Additional information about this illustration can be found in the surrounding text.

This illustration shows the revised stacked bar chart. Because the chart is wider, the text in the X Axis displays correctly. Additional information about this illustration can be found in the surrounding text.

This illustration shows the P900_REC_CREATE_DATE and P900_REC_UPDATE_DATE items after being moved to the Audit Information region. Additional information about this illustration can be found in the surrounding text.

The Issue Summary By Report and Assign Open Issues Report are shown in this illustration. Both of these reports are linked to from the Summary Report page.

This illustration shows the new Delete Products button appearing above the report. To remove a product from the report, select the Del check box and click Delete Products.

This illustration shows the Uploaded Files report with download links in the ID column. Additional information about this illustration can be found in the surrounding text.

This illustrates the Dashboard with all report regions added. There are three unassigned issues and only one that has been opened in the last week.

This illustrates how the Issue Summary, Issue Description and Progress text areas now have the labels above the text areas rather than to the left side.

This illustration shows the Filter Edit options. The column is set to 'Assigned To', the Operator is set to 'contains' and the Expression is equal to 'carla'.

This illustration shows the Target Resolution Dates report for January 2008. This report is a calendar displaying issues that have not yet closed and the assigned person on the day that corresponds to the target resolution date. Users can filter what displays by making a selection from the Project list and clicking Go. Users can view issue details by clicking on the issue. Users can move to other dates or calendar views by clicking from the series of buttons at the top: Weekly, Daily, Previous, Today, and Next.

This illustration shows the Issues report filtered for all issues assigned to Carla. The report displays two issues assigned to Carla.

This illustration shows the revised report of items Note that the new Stop and Start HTML Table appears beneath P2_EMP_ID.

This illustration shows the Project Details page for the Email Integration project with the Audit Information open.

This illustration shows the Report link on the Page Definition for page 1. Additional information about this illustration can be found in the surrounding text.

This illustration shows the home page of your newly created application.

This illustration shows the Uploaded Files report with a subject column. Additional information about this illustration can be found in the surrounding text.

This illustration shows the Issues report for all open Employee Satisfaction Survey issues. See surrounding text for further details.

This illustration shows the revised update form. Note that the Warranty Period field no longer displays and a new Set Minimum Price radio group appears.

The Target Resolution Dates and Average Days to Resolve reports are shown in this illustration. These are two of the reports you can navigate to from the Summary Report page.

This illustration shows the Run Page icon. The Run Page icon resembles a light green traffic light.

This illustration shows the Theater Information Report with data. In this example, a ZIP code and radius were entered into the fields. The report lists the movie theaters in the Name column and their addresses in the Address column.

This illustration shows the Access Control Administration page. Additional information about this illustration can be found in the surrounding text.

This illustration shows the Issues report and includes the Identified By, Identified Date, Project Name, Assigned To and Progress columns. See surrounding text for more information.

This illustration show the Reorder Region Items icon. This icon resembles a light green down or up arrow.

This illustration shows the Single Row View for the first issue. See surrounding text for further details.

This illustration shows the Create icon that displays in each section of the Page Definition. The Create icon resembles a plus (+) sign that overlaps a small page. Click the Create icon to create a new control or component.

This illustration shows the Month Identified report. The number of days it took to resolve an issue (Days to Resolves) is charted vertically, and the date that the issue was identified (Date Identified) is charted horizontally.

This User Information page shows user details for George Hurst. The edit icon for George Hurst was clicked on the previous Users page.

This illustrates the Unassigned Issues report on the Dashboard. Issues that are not assigned and are opened are included in this report.

This illustrates the Recently Assigned Issues report on the Dashboard. The five most recently opened issues within the last week.

This illustration shows the Drag and drop icon that displays in the Items section of the Page Definition. The Drag and drop icon resembles a green rectangle and displays to the right of the Reorder Region Items icon. You can use the Drag and Drop Layout page to interactively reorder items within a given region, change select item attributes, create new items, or delete existing items.

This illustration shows the first 3 rows of the Issues report with the additional Identified By, Project Name and Assigned To columns displayed. See surrounding text for further information.

This illustration shows the Employee Info form with P900_EMP_DEPT changed to a select list. Additional information about this illustration can be found in the surrounding text.

This is the action icon displayed in the Search Bar area of Interactive Reports.

This illustration shows the Link Column icon for the first issue. See surrounding text for further details.

This illustration shows the Assign Open Issues form. The form contains seven columns (Summary, Identified By, Identified Date, Related Project, Assigned To, Status, and Priority). An Apply Changes button appears in the upper right corner.

This illustration shows the completed report layout template. Additional information about this illustration is available in the surrounding text.

This illustration shows the Update Form with the Delete and Apply Changes buttons now appearing. Additional information about this illustration can be found in the surrounding text.

This illustration shows the IT_ISSUES Table when displayed from the Application Expresss Object Browser.

The application home page displays a horizontal list of images. At this point in the tutorial, you can use the Issues link to navigate to the Issues page.

This illustration shows the Issues interactive report for all New Payroll Rollout issues. See surrounding text for further details.

This illustration shows the Employee Info form, which contains basic employee details. This form includes the following fields: Emp First Name, Emp Middle Initial, Emp Last Name, Emp Part Or Full Time, Emp Salary, Emp Dept, Emp Hiredate, Emp Manager, Emp Special Info, Emp Telecommute, Rec Create Date, and Rec Update Date. Additional information about this illustration can be found in the surrounding text.

This illustration shows the Audit Information region as a Hide/Show region. You can hide the region by clicking the icon to the right of the region title. Additional information about this illustration can be found in the surrounding text.

This illustration shows the revised Issue report. An Add Issue button displays at the top of the page. Users can filter report results by making selections in the Search toolbar then clicking Go. Additional information about this illustration can be found in the surrounding text.

User information for Carla Downing, as it is shown on the User Information page, is illustrated by this screenshot.

This illustration shows the new region Hint. Since this region is in column 3, it displays to the right of the Employee Info form. Additional information about this illustration can be found in the surrounding text.

This illustration shows the Prerequisites page. The Prerequisites page contains the following sections: Required Free Space in KB, Required System Privileges, and Objects that will be Installed.

Additional information can be found in the surrounding text.

Oracle Legal Notices

Copyright Notice

Copyright © 1994-2012, Oracle and/or its affiliates. All rights reserved.

Trademark Notice

Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group.

License Restrictions Warranty/Consequential Damages Disclaimer

This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.

Warranty Disclaimer

The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing.

Restricted Rights Notice

If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable:

U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S. Government customers are "commercial computer software" or "commercial technical data" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of the Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software License (December 2007). Oracle America, Inc., 500 Oracle Parkway, Redwood City, CA 94065.

Hazardous Applications Notice

This software or hardware is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications that may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software or hardware in dangerous applications.

Third-Party Content, Products, and Services Disclaimer

This software or hardware and documentation may provide access to or information on content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services.

Alpha and Beta Draft Documentation Notice

If this document is in prerelease status:

This documentation is in prerelease status and is intended for demonstration and preliminary use only. It may not be specific to the hardware on which you are using the software. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to this documentation and will not be responsible for any loss, costs, or damages incurred due to the use of this documentation.