Skip Headers
Oracle® Database Express Edition 2 Day Plus Application Express Developer Guide
Release 2.1

Part Number B25310-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

10 How to Build and Deploy an Issue Tracking Application

Storing information in an Oracle database organizes it into tables that group similar information together and removes redundancies. Using the Oracle Application Express development environment, you can quickly build an application that enables a user to view and update information stored in an Oracle Database.

This tutorial describes how to create and deploy an application that tracks the assignment, status, and progress of issues related to a project.

Note:

This tutorial takes approximately four to five 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:

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 deadlines 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 with spreadsheets.

By creating a hosted application in Oracle Application Express, project leads can easily record and track issues in one central location. This approach allows each project lead to 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:

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

Defining Security Requirements

Because the project leads were 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

Selecting 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

Selecting 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

Defining 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 in 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:

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.

Topics in this section include:

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 10-1 describes the columns to be included in the Projects table.

Table 10-1 Project Table Details

Column Name Type Size Not Null? Constraints Description

project_id

integer

n/a

Yes

Primary key

A unique numeric identification number for each project.

Populated by a sequence using a trigger.

project_name

varchar2

100

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.


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.

Table 10-2 describes the columns that will be included in the People table.

Table 10-2 People Table Details

Column Name Type Size Not Null? Constraints Description

person_id

integer

n/a

Yes

Primary key

A numeric ID that identifies each user.

Populated by a sequence using a trigger.

person_name

varchar2

100

Yes

Unique key

A unique name that identifies each user.

person_email

varchar2

100

Yes

None

User email address.

person_role

varchar2

7

Yes

Check constraint

The role assigned to each user.


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 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 last modified the issue and on what date that modification was made.

Table 10-3 describes the columns to be included in the Issues table.

Table 10-3 Issue Table Details

Column Name Type Size Not Null? Constraints Description

issue_id

integer

n/a

Yes

primary key

A unique numeric ID that identifies an issue.

Populated by a sequence using a trigger

issue_summary

varchar2

200

Yes

None

A brief summary of the issue.

issue_description

varchar2

2000

No

None

A detailed description of the issue.

identified_by

integer

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

integer

n/a

Yes

foreign key to Projects

Projects related to the issue.

assigned_to

integer

n/a

No

foreign key to People

The person who owns this issue.

status

varchar2

8

Yes

check constraint

The issue status. Automatically set to Open when new and set to Closed when actual resolution date entered

priority

varchar2

6

No

check constraint

The priority of the issue.

target_resolution_date

date

n/a

No

None

The target resolution date.

progress

varchar2

2000

No

None

The progress of the issue.

actual_resolution_date

date

n/a

No

None

Actual resolution date of the issue.

resolution_summary

varchar2

2000

No

None

Resolution summary.

created_date

date

n/a

Yes

None

Populated by a trigger.

created_by

varchar2

60

Yes

None

User who created this issue.

last_modified_date

date

n/a

No

None

Populated by a trigger.


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 needed to be dynamic, you would need 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:

Build the 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 Object Browser and click Create. See "Managing Database Objects with Object Browser" in Oracle Database Express Edition 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 icon on Database Home Page and then click SQL Commands. See "Using SQL Commands" in Oracle Database Express Edition 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 on the Database Home Page, click SQL Scripts, and then click Upload. See "Uploading a SQL Script" in Oracle Database Express Edition 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 icon on the Database Home Page, select SQL Scripts, and then click Create. See "Creating a SQL Script in the Script Editor" in Oracle Database Express Edition Application Express User's Guide.

To build database objects by creating a script:

  1. Log in to Oracle Database Express Edition.

  2. On the Database Home Page, click the SQL icon.

  3. Click SQL Scripts.

  4. Click Create.

  5. In the Script Editor:

    1. For Script Name, enter DDL for Issue Management Application.

    2. Copy the DDL (data definition language) in "Create Application Database Objects DDL" and paste it into the script.

    3. Click Save.

To run the DDL for Issue Management Application script:

  1. On the SQL Scripts page, select the DDL for Issue Management Application icon.

    The Script Editor appears.

  2. Click Run.

    A summary page appears.

  3. Click Run again.

    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:

  1. Return to the Database Home Page by clicking the Home breadcrumb link.

  2. On the Database Home Page, click the Object Browser icon.

  3. From the Object list on left side of the page, select Tables.

  4. To view the details of a specific object, select one of the following tables:

    • HT_ISSUES

    • HT_PEOPLE

    • HT_PROJECTS

See Also:

"Managing Database Objects with Object Browser" in Oracle Database Express Edition 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 using the import functionality available in SQL Scripts. In the following exercise, you use SQL Scripts to load demonstration data.

Look at the DDL you copied from "Create Application Database Objects DDL". Notice that the sequences used for the primary keys start at 40 in order to leave room for the demonstration data. Because the BEFORE INSERT triggers are coded so that the sequence is only accessed if a primary key value is not provided, they will not need to be disabled in order for you to load data.

Topics in this section include:

Load Projects Data

To import data into the Projects table:

  1. Return to the Database Home Page by clicking the Home breadcrumb link.

  2. On the Database Home Page, click the SQL icon.

  3. Click the SQL Scripts icon.

  4. Click Create.

  5. In the Script Editor:

    1. In Script Name, enter Load Project Data.

    2. In Script, copy and paste the following:

      INSERT INTO ht_projects
            (project_id, project_name, start_date, target_end_date)   VALUES
            (1, 'Internal Infrastructure', sysdate-150, sysdate-30)
      /
      INSERT INTO ht_projects 
            (project_id, project_name, start_date, target_end_date)   VALUES
            (2, 'New Payroll Rollout', sysdate-150, sysdate+15)
      /
      INSERT INTO ht_projects 
            (project_id, project_name, start_date, target_end_date)   VALUES
            (3, 'Email Integration', sysdate-120, sysdate-60)
      /
      INSERT INTO ht_projects 
            (project_id, project_name, start_date, target_end_date)   VALUES
            (4, 'Public Website Operational', sysdate-60, sysdate+30)
      /
      INSERT INTO ht_projects 
            (project_id, project_name, start_date, target_end_date)   VALUES
            (5, 'Employee Satisfaction Survey', sysdate-30, sysdate+60)
      /
      
      
    3. Click Save.

  6. On the SQL Scripts page, select the Load Project Data icon.

  7. Click Run.

    A summary page appears.

  8. Click Run again.

    The Manage Script Results page displays a message that the script has been submitted for execution.

Update Dates to Make the Projects Current

Although you have created the projects, the dates need to be updated to make the projects current. To accomplish this, you run another script.

To update the project dates and make the projects current:

  1. Click the SQL Scripts breadcrumb link.

  2. Click Create.

  3. In the Script Editor:

    1. In Script Name, enter Update Project Dates.

    2. In Script, copy and paste the following:

      UPDATE ht_projects
         SET start_date = sysdate-150,
             target_end_date = sysdate-30
       WHERE project_id = 1
      /
      
      UPDATE ht_projects
         SET start_date = sysdate-150,
             target_end_date = sysdate+15
       WHERE project_id = 2
      /
      UPDATE ht_projects
         SET start_date = sysdate-120,
             target_end_date = sysdate-60
       WHERE project_id = 3
      /
      UPDATE ht_projects
         SET start_date = sysdate-60,
             target_end_date = sysdate+30
       WHERE project_id = 4
      /
      UPDATE ht_projects
         SET start_date = sysdate-30,
             target_end_date = sysdate+60
       WHERE project_id = 5
      /
      
      
    3. Click Save.

  4. On the SQL Scripts page, select the Update Project Dates icon.

  5. Click Run.

    A summary page appears.

  6. Click Run again.

    The Manage Script Results page displays a message that the script has been submitted for execution.

Load People Data

After you have loaded data into the Project table, you can load People data. Because of foreign keys in the Projects table, People data must be loaded after Project data. You load data into the People table by creating and running a script in SQL.

To load data into the People table:

  1. Click the SQL Scripts breadcrumb link.

  2. Click Create.

  3. In the Script Editor:

    1. In Script Name, enter Load People Data.

    2. In Script, copy and paste the following:

      INSERT INTO ht_people
           (person_id, person_name, person_email, person_role, assigned_project)
        VALUES
           (1, 'Joe Cerno', 'joe.cerno@mrvl-bademail.com', 'CEO', null)
      /
      INSERT INTO ht_people
           (person_id, person_name, person_email, person_role, assigned_project)
        VALUES
           (2, 'Kim Roberts', 'kim.roberts@mrvl-bademail.com', 'Manager', null)
      /
      INSERT INTO ht_people
           (person_id, person_name, person_email, person_role, assigned_project)
        VALUES
           (3, 'Tom Suess', 'tom.suess@mrvl-bademail.com', 'Manager', null)
      /
      INSERT INTO ht_people
           (person_id, person_name, person_email, person_role, assigned_project)
        VALUES
           (4, 'Al Bines', 'al.bines@mrvl-bademail.com', 'Lead', 1)
      /
      INSERT INTO ht_people
           (person_id, person_name, person_email, person_role, assigned_project)
        VALUES
           (5, 'Carla Downing', 'carla.downing@mrvl-bademail.com', 'Lead', 2)
      /
      INSERT INTO ht_people
           (person_id, person_name, person_email, person_role, assigned_project)
        VALUES
           (6, 'Evan Fanner', 'evan.fanner@mrvl-bademail.com', 'Lead', 3)
      /
      INSERT INTO ht_people
           (person_id, person_name, person_email, person_role, assigned_project)
        values
           (7, 'George Hurst', 'george.hurst@mrvl-bademail.com', 'Lead', 4)
      /
      INSERT INTO ht_people
           (person_id, person_name, person_email, person_role, assigned_project)
      VALUES
           (8, 'Irene Jones', 'irene.jones@mrvl-bademail.com', 'Lead', 5)
      /
      INSERT INTO ht_people
           (person_id, person_name, person_email, person_role, assigned_project)
        VALUES
           (9, 'Karen London', 'karen.london@mrvl-bademail.com', 'Member', 1)
      /
      INSERT INTO ht_people
           (person_id, person_name, person_email, person_role, assigned_project)
         values
           (10, 'Mark Nile', 'mark.nile@mrvl-bademail.com', 'Member', 1)
      /
      INSERT INTO ht_people
           (person_id, person_name, person_email, person_role, assigned_project)
        VALUES
           (11, 'Jane Kerry', 'jane.kerry@mrvl-bademail.com', 'Member', 5)
      /
      INSERT INTO ht_people
           (person_id, person_name, person_email, person_role, assigned_project)
        VALUES
           (12, 'Olive Pope', 'olive.pope@mrvl-bademail.com', 'Member', 2)
      /
      INSERT INTO ht_people
           (person_id, person_name, person_email, person_role, assigned_project)
        VALUES
           (13, 'Russ Sanders', 'russ.sanders@mrvl-bademail.com', 'Member', 3)
      /
      INSERT INTO ht_people
           (person_id, person_name, person_email, person_role, assigned_project)
        VALUES
           (14, 'Tucker Uberton', 'tucker.uberton@mrvl-bademail.com', 'Member', 3)
      /
      INSERT INTO ht_people
            (person_id, person_name, person_email, person_role, assigned_project)
        VALUES
            (15, 'Vicky Williams', 'vicky.willaims@mrvl-bademail.com', 'Member', 4)
      /
      INSERT INTO ht_people
            (person_id, person_name, person_email, person_role, assigned_project)
        VALUES
            (16, 'Scott Tiger', 'scott.tiger@mrvl-bademail.com', 'Member', 4)
      /
      INSERT INTO ht_people
            (person_id, person_name, person_email, person_role, assigned_project)
        VALUES
            (17, 'Yvonne Zeiring', 'yvonee.zeiring@mrvl-bademail.com', 'Member', 4)
      /
      
      
    3. Click Save.

  4. On the SQL Scripts page, select the Load People Data icon.

  5. Click Run.

    A summary page appears.

  6. Click Run again.

    The Manage Script Results page displays a message that the script has been submitted for execution.

Load Issues Data

The last data you need to load is the Issues data. As with People data, you create and run a script to populate the Issues table.

To load data into the Issues table:

  1. Click the SQL Scripts breadcrumb link.

  2. Click Create.

  3. In the Script Editor:

    1. In Script Name, enter Load Issue Data.

    2. In Script, copy and paste the script in "Create Issues Script".

    3. Click Save.

  4. On the SQL Scripts page, select the Load Issue Data icon.

  5. Click Run.

    A summary page appears.

  6. Click Run again.

    The Manage Script Results page displays a message that the script has been submitted for execution.

Building a Basic User Interface

After you create the objects that support your application and load the demonstration data, 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 the pages that support the data management and data presentation functions described in "Planning and Project Analysis".

Topics in this section include:

Create the Application

You use the Create Application Wizard to create an application containing pages that enable users to view reports on and create data for selected tables within a schema. Alternatively, you can create an application first and then add pages to it. Since the application requirements include customized overview pages, for this exercise you will use the latter approach.

To create the application:

  1. Click the Home breadcrumb link.

  2. On the Database Home Page, click the Application Builder icon.

  3. Click Create.

  4. For Method, select Create Application.

  5. For Name:

    1. In Name, enter a Issue Tracker.

    2. For Create Application, select From scratch.

    3. Click Next.

  6. Add a blank page:

    1. Under Select Page Type, select Blank.

    2. Click Add Page.

    3. Click Next.

  7. For Tabs, select No Tabs and click Next.

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

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

  10. For User Interface, select Theme 10 and click Next.

  11. Click Create.

To view the application:

  1. Click the Run Application icon on the Applications home page.

  2. When prompted, enter your database account username and password and click Login.

    This authentication is part of the default security of any newly created application. As shown in Figure 10-1, the home page appears.

    Figure 10-1 Issue Tracking Application Home Page

    Description of Figure 10-1 follows
    Description of "Figure 10-1 Issue Tracking Application Home Page"

    Although the page has no content, notice that the Create Application Wizard created the following items:

    • Navigation Links - A navigation bar entry displays in the upper right of the page. Logout enables the user to log out of the application.

    • Developer Links - The Developer toolbar appears at the bottom of 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. From left to right, the Developer toolbar contains the following links:

      • Edit Application - Edit the application by linking to the Application Builder home page.

      • Edit Page 1 - Edit the current running page. This link takes you to Page Definition for the current page.

      • Create - Add a new component to the current page.

      • Session - Open a new page containing session details for the current page.

      • Debug - Display the current page in debug mode.

      • Show Edit Links - Displays edit links next to each object on the page that can be edited. Each edit link resembles two colons (::) and appears to the right of navigation bar items, tabs, region titles, buttons, and items. Clicking an edit link displays another window where you can edit the object.

  3. Click Edit Application on the Developer toolbar to return to Application Builder 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 create individual pages.

Add Pages to Maintain Projects

First, you need to create pages that enable users to view and add data to tables. To accomplish this, you use the Form on a Table with Report Wizard. This wizard creates a report page and maintenance page for each table.

Topics in this section include:

Create Pages for Maintaining Projects

To create pages for maintaining the HT_PROJECTS table:

  1. On the Application Builder home page, click Create Page.

  2. Select Form and click Next.

  3. Select Form on a Table with Report and click Next.

  4. For Table/View Owner, select the appropriate schema and click Next.

  5. For Table/View Name, select HT_PROJECTS and click Next.

  6. For Define Reports Page:

    1. For Page, enter 2.

    2. For Page Name and Region Title, enter Projects.

    3. Click Next.

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

  8. For Select Column(s), select every column except PROJECT_ID 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.

  9. For Edit Link Image, select the third option (the word Edit in blue with a white background) and click Next.

  10. For Define Form Page:

    1. For Page, enter 3.

    2. For Page Name and Region Title, enter Create/Edit Project.

    3. Click Next.

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

  12. For Primary Key, accept the default PROJECT_ID and click Next.

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

  14. For Select Column(s), select all columns and click Next.

  15. Under Identify Process Options, accept the defaults for Insert, Update and Delete, and click Next.

  16. Review your selections and click Finish.

  17. Click the Run Page icon.

As shown in Figure 10-2, the newly created report displays the demo data.

Figure 10-2 Projects Page

Description of Figure 10-2 follows
Description of "Figure 10-2 Projects Page"

Click the Edit icon to view an existing row or click the Create button to create a new record. If you click the Edit icon to the left of Employee Satisfaction Survey, a form resembling Figure 10-3 appears.

Figure 10-3 Create/Edit Project Form

Description of Figure 10-3 follows
Description of "Figure 10-3 Create/Edit Project Form"

Refine the Appearance of the Projects Report Page

You can change the appearance of the Projects report page by adding a format mask to the dates.

To add a format mask to the dates on the Create/Edit Project page:

  1. Navigate to the Page Definition for page 2, Projects:

    1. Click Edit Application on the Developer toolbar.

    2. On the Application home page, select 2 - Projects.

  2. Under Regions, select Report adjacent to Projects.

  3. Edit the format for START_DATE:

    1. Click the Edit icon the left of START_DATE.

      The Column Attributes page appears.

    2. For Number/Date Format, enter DD-MON-YYYY.

  4. Edit the format for the TARGET_END_DATE:

    1. Click the Next button (>) at the top of the page to navigate to the next Report Item.

      The Column Attributes page appears.

    2. For Number/Date Format, enter DD-MON-YYYY.

  5. Edit the format for the ACTUAL_END_DATE:

    1. Click the Next button (>) at the top of the page to navigate to the next Report Item.

      The Column Attributes page appears.

    2. For Number/Date Format, enter DD-MON-YYYY.

  6. Click Apply Changes.

    The Report Attributes page appears.

  7. For PROJECT_ID, delete the Heading Edit.

  8. For the START_DATE, TARGET_END_DATE and ACTUAL_END_DATE columns, select center for Column Alignment and Heading Alignment.

  9. To enable column heading sorting, check Sort for all columns except PROJECT_ID.

  10. For PROJECT_NAME, select 1 for Sort Sequence.

    This selection specifies PROJECT_NAME as the default column to sort on. Note this functionality can overridden by any user selections.

  11. Scroll down to Sorting. For Ascending and Descending Image, select the light gray arrow.

  12. Under Messages, enter the following in When No Data Found Message:

    No Projects found.
    
    
  13. Scroll up to the top of the page and click Apply Changes.

To view your changes, click the Run Page icon in the upper right of the page.

As shown in Figure 10-4, note the addition of a sort control on the Project Name column and the format of the dates in the Start Date and Target End Date columns.

Figure 10-4 Projects Page with Sort Control

Description of Figure 10-4 follows
Description of "Figure 10-4 Projects Page with Sort Control"

Refine the Create/Edit Project Page

Next, you need to customize the Create/Edit Project page to make the Project Name field larger and the date fields smaller. You also need to change the date picker type, add a format mask for dates, and add validations that check if the target and actual end dates are after the start date.

To make the Project Name field larger and the date fields smaller:

  1. Navigate to the Page Definition for Page 3, Create/Edit Project.

    1. From the Developer toolbar, click Edit Application.

    2. Select 3 - Create/Edit Project.

  2. Under the Page Rendering section, select the Items heading.

  3. Scroll to the right and locate the Width column:

    1. For Project Name, enter 60.

    2. For Start Date, enter 12.

    3. For Target End Date, enter 12.

    4. For Actual End Date, enter 12.

    5. Click Apply Changes.

  4. Click the Edit Page icon in the upper right corner of the page to return to the Page Definition.

To change the date picker type and add a format mask for dates:

  1. Edit the item P3_START_DATE.

    1. Under Items, select P3_START_DATE.

    2. Under Name, for Display As select Date Picker (DD-MON-YYYY).

    3. Click Apply Changes.

    Edit the item P3_TARGET_END_DATE.

    1. Under Items, select P3_TARGET_END_DATE.

    2. Under Name, for Display As select Date Picker (DD-MON-YYYY).

    3. Click Apply Changes.

    Edit the item P3_ACTUAL_END_DATE.

    1. Under Items, select P3_ACTUAL_END_DATE.

    2. Under Name, for Display As select Date Picker (DD-MON-YYYY).

    3. Click Apply Changes.

To add validations to check if the target and actual end dates are after the start date:

  1. Under the Validations section, click the Create icon.

  2. For Level, accept the default Item level validation and click Next.

  3. For Item, select Create/Edit Project: 40. P3_TARGET_END_DATE (Target End Date) and click Next.

  4. For Validation Method, select PL/SQL and click Next.

  5. Specify the type of validation you want to create. Accept the default PL/SQL Expression and click Next.

  6. For Validation Name, enter TARGET_AFTER_START and click Next.

  7. For Validation and Error Message:

    1. For Validation, enter:

      to_date(:P3_ACTUAL_END_DATE,'DD-MON-YYYY') >= to_date(:P3_START_DATE,'DD-MON-YYYY')
      
      
    2. For Error Message, enter:

      Actual End Date must be same or after Start Date.
      
      
    3. Click Next.

  8. For Conditions:

    1. For Condition Type, select Value of Item in Expression 1 Is NOT NULL, or click the shortcut link [item not null].

    2. For Expression 1, enter:

      P3_ACTUAL_END_DATE.
      
      

      This selection ensures that this validation only executes if the user enters an Actual End Date.

    3. Click Create.

To view your changes, click the Run Page icon in the upper right of the page. (See Figure 10-5.)

Figure 10-5 Modified Create/Edit Project

Description of Figure 10-5 follows
Description of "Figure 10-5 Modified Create/Edit Project "

Add Pages to Track People

Once the initial Projects pages are complete, you create pages for maintaining people.

Topics in this section include:

Create Pages for Maintaining People

To create pages for maintaining the HT_PEOPLE table:

  1. Return to the Application home page. If you are viewing the Create/Edit Project form, click Edit Application on the Developer toolbar.

  2. Click Create Page.

  3. Select Form and click Next.

  4. Select Form on a Table with Report and click Next.

  5. For Table/View Owner, select the appropriate schema and click Next.

  6. For Table/View Name, select HT_PEOPLE and click Next.

  7. For Define Report Attributes:

    1. For Page, enter 4.

    2. For Page Name and Region Title, enter People.

    3. Click Next.

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

  9. For Select Column(s), select all columns except PERSON_ID and click Next.

  10. For Edit Link Image, select the third option (the word Edit in blue with a white background) and click Next.

  11. For Define Form Page:

    1. For Page, enter 5.

    2. For Page Name and Region Title, enter Create/Edit Person. Information.

    3. Click Next.

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

  13. For Primary Key, accept the default PERSON_ID and click Next.

  14. Specify the source for the primary key columns. Accept the default Existing Trigger and click Next.

  15. For Select Column(s), select all the columns and click Next.

  16. For Insert, Update and Delete, accept the defaults and click Next.

  17. Review your selections and click Finish.

To preview your page, click Run Page. As shown in Figure 10-6, notice the newly created report displays the demo data.

To preview the page for adding or editing people, click the Edit button in the far left column.

Modify the People Report Page

Next, you alter the People Report by changing the query to include a join to the Projects table and modify the headings.

To change the query to include a join to the Projects table:

  1. Navigate to the Page Definition for page 4 - People:

    1. If you are viewing a running form, click Edit Application on the Developer toolbar.

    2. When the Application home page appears select 4 - People.

  2. Under Regions, select People.

  3. Scroll down to Source.

  4. In Region Source, replace the existing query with the following:

    SELECT a."PERSON_ID", 
           a."PERSON_NAME",
           a."PERSON_EMAIL",
           a."PERSON_ROLE",
           b."PROJECT_NAME"
       FROM "#OWNER#"."HT_PEOPLE" a,
            "#OWNER#"."HT_PROJECTS" b
     WHERE a.assigned_project = b.project_id (+)
    
    

    Note that the outer join is necessary because the project assignment is optional.

  5. Select the Report Attributes tab at the top of the page.

    1. For PERSON_ID, remove the Heading Edit.

    2. For PERSON_NAME, change Heading to Name.

    3. For PERSON_EMAIL, change Heading to Email.

    4. For PERSON_ROLE, change Heading to Role.

    5. For PROJECT_NAME, change Heading to Assigned Project and select left for Heading Align.

  6. Enable column heading sorting by selecting Sort for all columns except PERSON_ID.

  7. For PERSON_NAME, select 1 for Sort Sequence.

    This selection specifies PERSON_NAME as the default column to sort on. Note this functionality can overridden by user selections.

  8. Scroll down to Sorting. For Ascending and Descending Image, select the light gray arrow.

  9. Under Messages, enter the following in When No Data Found Message:

    No people found.
    
    
  10. Click Apply Changes.

To view your changes, click the Run Page icon in the upper right of the page. As shown in Figure 10-7, note the addition of a sort control on the Name column.

Figure 10-7 Revised People Page

Description of Figure 10-7 follows
Description of "Figure 10-7 Revised People Page"

Refine the Create/Edit People Page

Next, you customize the Create/Edit People page by adding lists of values to make it easier for users to select a Role or Assigned Project.

Add Lists of Values

To add a list of values for Projects:

  1. Navigate to the Page Definition for page 5, Create/Edit Person:

    1. If you are viewing a running form, click Edit Application on the Developer toolbar.

    2. When the Application home page appears select 5 - Create/Edit Person.

  2. Under Shared Components, locate the Lists of Values section and click the Create icon.

  3. For Source, accept the default From Scratch and click Next.

  4. For Name and Type:

    1. For Name, enter PROJECTS.

    2. For Type, select Dynamic.

    3. Click Next.

  5. In Query, replace the existing statements with the following:

    SELECT project_name d, project_id v
      FROM ht_projects
     ORDER BY d
    
    
  6. Click Create List of Values.

To add a list of values for Roles:

  1. Under Shared Components, locate the Lists of Values section and click the Create icon.

  2. For Source, accept the default From Scratch and click Next.

  3. For Name and Type:

    1. For Name, enter ROLES.

    2. For Type:, select Static

    3. Click Next.

  4. Enter the display value and return value pairs shown in Table 10-4:

    Table 10-4 Display Value and Return Value pairs

    Display Value Return Value

    CEO

    CEO

    Manager

    Manager

    Lead

    Lead

    Member

    Member


  5. Click Create List of Values.

  6. Return to the Page Definition for Page 5. Click the Edit Page icon in the upper right corner.

Edit Display Attributes

To edit display attributes for P5_PERSON_ROLE:

  1. Under Items, select P5_PERSON_ROLE.

  2. Under Name, select Radiogroup from the Display As list.

  3. Scroll down to Label.

  4. Change Label to Role.

  5. Under Element, enter the following in Form Element Option Attribute:

    class="instructiontext"
    
    

    This specifies that the text associated with each radio group option is the same size as other items on the page.

  6. Scroll down to List of Values.

  7. From the Named LOV list, select ROLES.

  8. Click Apply Changes.

To edit display attributes for P5_ASSIGNED_PROJECT:

  1. Under Items, select P5_ASSIGNED_PROJECT.

  2. Under Name, select Select List from the Display As list.

  3. Scroll down to List of Values.

  4. Under List of Values:

    1. From the Named LOV list, select PROJECTS.

      Next, specify that the underlying column is not mandatory.

    2. For Null display value, enter:

      - None -
      
      
  5. Click Apply Changes.

To alter the display of fields and field labels:

  1. Under the Page Rendering section, select the Items heading.

  2. For P5_PERSON_NAME:

    1. For Prompt, enter Name.

    2. For Width, enter 60.

  3. For P5_PERSON_EMAIL:

    1. For Prompt, enter Email Address.

    2. For Width, enter 60.

  4. Click Apply Changes.

  5. Click the Edit Page icon in the upper right corner to return to the Page Definition for Page 5.

Create a Validation

The Form on a Table with Report Wizard created not null validations for Name, Email, and Role. 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:

  1. Under the Validations section, click the Create icon.

  2. On Level, accept the default Item level validation and click Next.

  3. On Item, select Create/Edit Person Information: 50. P5_ASSIGNED_PROJECT (Assigned Project) and click Next.

  4. On Validation Method:

    1. Select PL/SQL and click Next.

    2. Accept the default, PL/SQL Expression, and click Next.

  5. For Validation Name, enter PROJECT_MAND_FOR_LEADER_AND_MEMBER and click Next.

  6. For Validation and Error Message:

    1. For 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 so to keep it in the validation, you need to break the string apart so that it is not recognized and replaced.

    2. For Error Message, enter:

      Leads and Members must have an Assigned Project. CEO and Managers cannot have an Assigned Project.
      
      
    3. Click Next.

  7. Click Create.

To view your changes, click the Run Page icon in the upper right of the page. (See Figure 10-8.)

Figure 10-8 Revised Create/Edit Person Information Form

Description of Figure 10-8 follows
Description of "Figure 10-8 Revised Create/Edit Person Information Form"

Try entering some records to test the validation. Enter a CEO with a project and then enter a Lead without a project. Both cases should fail and display the error message you defined.

Add Pages to Track Issues

Lastly, you need to create pages for HT_ISSUES. 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.

Topics in this section include:

Create a Report for HT_ISSUES

To create a report for maintaining HT_ISSUES:

  1. Return to the Application home page. If you are viewing a running form, click Edit Application on the Developer toolbar.

  2. Click Create Page.

  3. Select Form and click Next.

  4. Select Form on a Table with Report and click Next.

  5. For Table/View Owner, select the appropriate schema and click Next.

  6. For Table/View Name, select HT_ISSUES and click Next.

  7. On Define Report Page:

    1. For Page, enter 6.

    2. For Page Name and Region Title, enter Issues.

    3. Click Next.

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

  9. For Select Column(s), select the following and click Next:

    • ISSUE_SUMMARY

    • IDENTIFIED_BY

    • RELATED_PROJECT

    • ASSIGNED_TO

    • STATUS

    • PRIORITY

    • TARGET_RESOLUTION_DATE

    • ACTUAL_RESOLUTION_DATE

  10. For Edit Link Image, select the third option (the word Edit in blue with a white background) and click Next.

  11. On Define Form Page:

    1. For Page, enter 7.

    2. For Page Name and Region Title, enter Create/Edit Issues.

    3. Click Next.

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

  13. For Primary Key, accept the default, ISSUE_ID, and click Next.

  14. For Select Column(s), press SHIFT and select all the columns and click Next.

  15. For Insert, Update and Delete, accept the default value, Yes, and click Next.

  16. Review your selections and click Finish.

Refine the Create/Edit Issues Page

When you refine the Create/Edit Page you:

  • Add lists of values to make it easier for users to select foreign key columns

  • Organize and clean up items

  • Change the display of audit columns

  • Add a button to make data entry faster

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:

  1. Navigate to the Page Definition for page 7.

  2. Under the Lists of Values section, click the Create icon.

  3. For Create List of Values, accept the default From Scratch and click Next.

  4. On Create List of Values (LOV):

    1. For Name, enter STATUS.

    2. For Type, select Static.

    3. Click Next.

  5. Enter the Display Value and Return Value pairs shown in Table 10-5:

    Table 10-5 Display Value and Return Value Pairs

    Display Value Return Value

    Open

    Open

    On-Hold

    On-Hold

    Closed

    Closed


  6. Click Create List of Values.

To add a list of values for Priorities:

  1. Return to the Page Definition for Page 7. Click the Edit Page icon in the upper right corner.

  2. Under the Lists of Values section and click the Create icon.

  3. For Create List of Values, accept the default From Scratch and click Next.

  4. On Create List of Values (LOV):

    1. For Name, enter PRIORITIES.

    2. For Type, select Static.

    3. Click Next.

  5. Enter the Display Value and Return Value pairs shown in Table 10-6.

    Table 10-6 Display Value and Return Value Pairs

    Display Value Return Value

    High

    High

    Medium

    Medium

    Low

    Low


  6. Click Create List of Values.

To add a list of values for People:

  1. Return to the Page Definition for Page 7. Click the Edit Page icon in the upper right corner.

  2. Under the Lists of Values section and click the Create icon.

  3. For Create List of Values, accept the default From Scratch and click Next.

  4. On Create List of Values (LOV):

    1. For Name, enter PEOPLE.

    2. For Type, select Dynamic.

    3. Click Next.

  5. In Query, replace the existing statements with the following:

    SELECT person_name d, person_id v
       FROM ht_people
     ORDER BY 1
    
    
  6. Click Created List of Values.

Edit Specific Items

Next, you edit individual items.

To edit P7_IDENTIFIED_BY:

  1. Return to the Page Definition for Page 7 by clicking the Edit Page icon in the upper right corner.

  2. Under Items, select P7_IDENTIFIED_BY.

  3. Under Name, select Select List from the Display As list.

  4. Scroll down to List of Values:

    1. For Named LOV, select PEOPLE.

    2. For Display Null, select Yes. The base column is mandatory but you do not want the first name in the list becoming the default value.

    3. For Null display value, enter:

      - Select Person -
      
      
  5. Click the Next button (>) at the top of the page to navigate to the next item.

To edit P7_IDENTIFIED_DATE:

  1. Navigate to P7_IDENTIFIED_DATE.

  2. Under Name, select Date Picker (DD-MON-YYYY) from the Display As list.

  3. Scroll down to Default:

    1. For Default value, enter:

      to_char(sysdate,'DD-MON-YYYY')
      
      
    2. For Default Value Type, select PL/SQL Expression.

  4. Click the Next button (>) at the top of the page to navigate to the next item.

To edit P7_RELATED_PROJECT:

  1. Navigate to P7_RELATED_PROJECT.

  2. Under Name, select Select List from the Display As list.

  3. Scroll down to List of Values:

    1. For Named LOV, select PROJECTS.

    2. For Display Null, select Yes.

    3. For Null display value, enter:

      - Select Project -
      
      
  4. Click the Next button (>) at the top of the page to navigate to P7_STATUS.

To edit P7_STATUS:

  1. Navigate to P7_STATUS.

  2. Under Name, select Radiogroup from the Display As list.

  3. In Label, enter:

    Status:
    
    
  4. Scroll down to Element. Enter the following in the Form Element Option Attributes:

    class="instructiontext"
    
    
  5. Scroll down to Default. In Default Value, enter Open.

  6. Scroll down to List of Values:

    1. For Named LOV, select STATUS.

    2. For Columns, enter 3.

      This selection enables the three valid values to display side by side.

  7. Click the Next button (>) at the top of the page to navigate to P7_PRIORITY.

To edit P7_PRIORITY:

  1. Navigate to P7_PRIORITY.

  2. Under Name, select Radiogroup from the Display As list.

  3. In Label, enter:

    Priority:
    
    
  4. Scroll down to Element. Enter the following in the Form Element Option Attributes:

    class="instructiontext"
    
    
  5. Scroll down to Default. In Default value, enter Open.

  6. Scroll down to List of Values:

    1. For Named LOV, select PRIORITIES.

    2. For Display Null, select Yes.

    3. For Columns, enter 4.

      This selection reflects that fact there are three valid values plus the null value.

    4. For Null display value, enter -None-.

  7. Click the Next button (>) at the top of the page to navigate to the next item.

To edit P7_TARGET_RESOLUTION_DATE:

  1. Navigate to P7_TARGET_RESOLUTION_DATE.

  2. Under Name, select Date Picker (DD-MON-YYYY) from the Display As list.

  3. Click the Next button (>) at the top of the page to navigate to P7_ACTUAL_RESOLUTION_DATE.

To edit P7_ACTUAL_RESOLUTION_DATE:

  1. Navigate to P7_ACTUAL_RESOLUTION_DATE.

  2. Under Name, select Date Picker (DD-MON-YYYY) from the Display As list.

  3. Click Apply Changes.

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. Next, you create four new regions named Buttons, Identification, Progress, Resolution, and Auditing.

To create new regions to group items:

  1. Under Regions, click the Create icon.

  2. Select Multiple HTML.

  3. For the first row:

    • For Sequence, enter 5.

    • For Title, enter Buttons.

    • For Template, select Button Region without Title.

  4. For the second row, in Title enter Progress.

  5. For the third row, in Title enter Resolution.

  6. For the fourth row, in Title enter Audit Information.

  7. Click Create Region(s).

Now that the new regions exist, rename the first region, Create/Edit Issues:

  1. Under Regions, select Create/Edit Issue.

  2. In Title, enter:.

    Issue Identification
    
    
  3. 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:

  1. Under the Page Rendering section, select the Items heading.

  2. Under Region, select Progress for the following items:

    • P7_ASSIGNED_TO

    • P7_STATUS

    • P7_PRIORITY

    • P7_TARGET_RESOLUTION_DATE

    • P7_PROGRESS

  3. Under Region, select Resolution for the following items:

    • P7_ACTUAL_RESOLUTION_DATE

    • P7_RESOLUTION_SUMMARY

  4. Under Region, select Audit Information for the following items:

    • P7_CREATED_DATE

    • P7_CREATED_BY

    • P7_LAST_MODIFIED_DATE

    • P7_LAST_MODIFIED_BY

  5. For P7_ISSUE_SUMMARY, enter 60 for Width.

  6. For P7_IDENTIFIED_DATE, enter 12 for Width.

  7. For P7_TARGET_RESOLUTION_DATE, enter 12 for Width.

  8. For P7_ACTUAL_RESOLUTION_DATE, enter 12 for Width.

  9. Click Apply Changes.

  10. Click the Edit Page icon in the upper right to return the Page Definition of Page 7.

To move buttons to the Button region:

  1. Return to the Page Definition for Page 7.

  2. Under the Page Rendering section, select the Buttons heading.

  3. Under Region for all buttons, select Buttons.

  4. Click Apply Changes.

  5. Click the Edit Page icon in the upper right to return the Page Definition of Page 7.

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.

  1. On the Page Definition for Page 7, under Regions, select Audit Information.

  2. Scroll down to Conditional Display.

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

  4. In Expression 1, enter P7_ISSUE_ID.

  5. Click Apply Changes.

Next, change the audit columns to display only.

To edit P7_CREATED_DATE:

  1. Under Items, select P7_CREATED_DATE.

  2. Under Name, select Display as Text (saves state) from the Display As list.

  3. Scroll down to Label:

    1. For Label, enter:

      Created Date:
      
      
    2. For Template, select Optional Label with Help.

    3. For HTML Table Cell Attributes, enter:

      class="instructiontext"
      
      
  4. Scroll down to Source and enter the following in Format Mask:

    DD-MON-YYYY
    
    
  5. Click the Next button (>) at the top of the page to navigate to the next item.

To edit P7_CREATED_BY:

  1. Under Name, select Display as Text (saves state) from the Display As list.

  2. Scroll down to Label:

    1. For Label, enter:

      Created By:
      
      
    2. For Template, select Optional Label with Help.

    3. For HTML Table Cell Attributes, enter:

      class="instructiontext"
      
      
  3. Click the Next button (>) at the top of the page to navigate to the next item.

To edit P7_LAST_MODIFIED_DATE:

  1. Under Name, select Display as Text (saves state) from the Display As list.

  2. Scroll down to Label:

    1. For Label, enter:

      Last Modified Date:
      
      
    2. For Template, select Optional Label with Help.

    3. For HTML Table Cell Attributes, enter:

      class="instructiontext"
      
      
  3. Scroll down to Source and enter the following in Format Mask:

    DD-MON-YYYY
    
    
  4. Click the Next button (>) at the top of the page to navigate to the next item.

To edit P7_LAST_MODIFIED_BY:

  1. Under Name, select Display as Text (saves state) from the Display As list.

  2. Scroll down to Label:

    1. For Label, enter:

      Last Modified By:
      
      
    2. For Template, select Optional Label with Help.

    3. For HTML Table Cell Attributes, enter:

      class="instructiontext"
      
      
  3. Click Apply Changes.

Remove Unnecessary Validations

The Form on a Table with Report Wizard created not null validations for Issue Summary, Identified By, Related Project, Status, Created Date, and Created By. Since the Audit columns are set by a trigger, you need to remove these validations.

To remove not null validations:

  1. Under Validations, select P7_CREATED_DATE not null.

  2. Click Delete.

    A dialog box displays prompting you to confirm the deletion.

  3. Click OK to confirm your selection.

  4. Under Validations, select P7_CREATED_BY not null.

  5. Click Delete.

    A dialog box displays prompting you to confirm the deletion.

  6. Click OK to confirm your selection.

Return the User to the Calling Page

Because this Create/Edit 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 Create/Edit page. Every time the Create/Edit page is called, the item must be set with the number of the calling page.

To create a hidden item:

  1. Under Items, click the Create icon.

  2. For Select Item Type, select Hidden and click Next.

  3. For Display Position and Name:

    1. For Item Name, enter:

      P7_PREV_PAGE
      
      
    2. For Region, select Issue Identification.

    3. Click Next.

  4. Click Create Item.

    The Page Definition for page 7 appears.

    Next, edit the Cancel button.

To edit the Cancel button:

  1. Under Buttons, select Cancel.

  2. Scroll down to Optional URL Redirect.

  3. In Page, enter:

    &P7_PREV_PAGE.
    
    

    Note the period at the end.

  4. Click Apply Changes.

    Next, edit the branch.

To edit the branch:

  1. Under Action, enter the following in Page (be sure to include the period):

    &P7_PREV_PAGE.
    
    
  2. 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 time. To accomplish this, you first add a new button and then create a new branch.

To add a new button:

  1. Under Buttons, click the Copy icon.

  2. Under Name, select CREATE.

  3. For Target Page, accept the default 7 and click Next.

  4. For Button Name, enter CREATE_AGAIN.

  5. For Label, enter Create and Create Another.

  6. Click Copy Button.

Functionally, the Copy Button currently works the same as the CREATE 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:

  1. Under Branches, click the Create icon.

  2. For Point and Type, accept the defaults and click Next.

  3. For Target:

    1. For Page, enter 7.

    2. For Clear Cache, enter 7.

    3. For Set these items, enter the following:

      P7_PREV_PAGE
      
      
    4. For With these values, enter (be sure to include the period):

      &P7_PREV_PAGE.
      
      
    5. Click Next.

  4. For Branch Conditions:

    1. For Sequence, enter 0.

    2. For When Button Pressed, select CREATE_AGAIN.

  5. Click Create Branch.

    The Page Definition for page 7 appears.

  6. Under Branches, select the newly created branch.

  7. Under Action, select include process success message.

  8. Click Apply Changes.

    To see the changes, click the Run Page icon. (See Figure 10-9.)

    Figure 10-9 Create/Edit Issues Form

    Description of Figure 10-9 follows
    Description of "Figure 10-9 Create/Edit Issues Form"

    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:

  • Move the Create button to a new region and edit the label

  • Create new items that enable the user to restrict the query

  • Add a WHERE clause to reference those new items

  • Alter the report column attributes to display each person's name and the project

  • Modify headings

Move Create Button to a New Region

To create a new region of the Create button:

  1. Navigate to the Page Definition for page 6, Issues.

  2. Under Regions, click the Create icon.

  3. Select HTML and click Next.

  4. Specify the type of HTML region container you want to create. Select HTML and click Next.

  5. For Display Attributes:

    1. For Title, enter Buttons.

    2. For Region Template, select Button Region without Title.

    3. For Display Point, select Page Template Body (2. items below region content).

    4. Click Next.

  6. Click Create Region.

To move the Create button to the Buttons region:

  1. Under Buttons, select the CREATE button.

  2. In Text Label, enter:

    Add a New Issue
    
    
  3. From Display in Region, select Buttons.

  4. Scroll down to Optional URL Redirect:

    1. For Set These Items, enter:

      P7_PREV_PAGE
      
      
    2. For With These Values, enter 6.

  5. Click Apply Changes.

Alter the Query and Display

Next, alter the query to display the actual values for people and projects instead of the ID and then clean up the report display.

To edit column attributes for ISSUE_ID:

  1. Under the Regions section, select Report adjacent to Issues.

    The Report Attribute page appears.

  2. Click the Edit Icon to the left of ISSUE_ID.

  3. Scroll down to Column Link.

    1. For Item 2, for Name enter:

      P7_PREV_PAGE
      
      
    2. For Item 2, for Value enter 6.

  4. Click Apply Changes.

To edit column attributes for IDENTIFIED_BY, RELATED_PROJECT and ASSIGNED_TO:

  1. Click the Edit Icon to the left of IDENTIFIED_BY.

  2. Scroll down to Tabular Form Element. From the Display As list, select Display as Text (based on LOV, does not save state).

  3. Scroll down to List of Values. For Named LOV, select PEOPLE.

  4. Return to the top of the page and click the Next (>) icon.

    The Column Attributes page for RELATED_PROJECT appears.

  5. Scroll down to Tabular Form Element. From the Display As list, select Display as Text (based on LOV, does not save state).

  6. Scroll down to List of Values:

    1. For Named LOV, select PROJECTS.

    2. For Display Null, select Yes.

    3. In Null Text, enter a hyphen (-).

  7. Return to the top of the page and click the Next (>) icon.

    The Column Attributes page for ASSIGNED_TO appears.

  8. Scroll down to Tabular Form Element. From the Display As list, select Display as Text (based on LOV, does not save state).

  9. Scroll down to List of Values:

    1. For Named LOV, select PEOPLE.

    2. For Display Null, select Yes.

    3. In Null Text, enter a hyphen (-).

  10. Click Apply Changes.

    The Report Attributes page appears.

Next, you customize how the report displays by changing report attributes.

To alter the report display:

  1. From Headings Type, select Custom.

  2. For ISSUE_ID, delete the current entry under Heading.

  3. For ISSUE_SUMMARY, change Heading to Summary.

  4. For TARGET_RESOLUTION_DATE:

    1. Force the heading to wrap. In Heading, enter:

      Target<br>Resolution<br>Date
      
      
    2. For Column Align., select center.

    3. For Heading Align. select center.

  5. For all columns except ISSUE_ID, check Sort.

  6. For ISSUE_SUMMARY, select 1 for Sort Sequence.

  7. Scroll down to Layout and Pagination:

    1. For Show Null Values as, enter a hyphen (-).

    2. For Number of Rows, enter 5.

  8. Under Sorting, select the light gray arrow for Ascending and Descending Image.

  9. Under Messages, enter the following in When No Data Found Message:

    No issues found.
    
    
  10. Click Apply Changes.

Add Support of Filtering

Although the report now displays nicely, it does not support filtering by the end user. To add this functionality, you first create items that enable the user to set values to query against. You will store these new items in a new region which will display above the report.

To create a new region:

  1. Under Regions, click the Create icon.

  2. Select HTML and click Next.

  3. Select the type of HTML region container you want to create. Select HTML and click Next.

  4. For Display Attributes:

    1. For Title, enter Issue Report Parameters.

    2. For Region Template, select accept the default of Reports Region.

    3. For Sequence, enter 5.

    4. Click Next.

  5. Click Create Region.

Next, create the items.

To create the item for Identified By:

  1. Under Items, click the Create icon.

  2. For Select Item Type, select Select List and click Next.

  3. For Select List Control Type, accept the default selection Select List and click Next.

  4. On Display Position and Name:

    1. For Item Name, enter P6_IDENTIFIED_BY.

    2. For Region, select Issue Report Parameters.

    3. Click Next.

  5. On Identify List of Values:

    1. For Named LOV, select PEOPLE.

    2. For Null Text, enter:

      - All -
      
      
    3. For Null Value, enter:

      -1
      
      
    4. Click Next.

  6. For Item Attributes, accept the defaults and click Next.

  7. On Source, for Default, enter:

    -1
    
    
  8. Click Create Item.

To create an item for Assigned To:

  1. Under Items, click the Create icon.

  2. For Select Item Type, select Select List and click Next.

  3. For Select List Control Type, accept the default selection Select List and click Next.

  4. For Display Position and Name:

    1. For Item Name, enter P6_ASSIGNED_TO.

    2. For Region, select Issue Report Parameters.

    3. Click Next.

  5. On Identify List of Values:

    1. For Named LOV, select PEOPLE.

    2. For Null Text, enter:

      - All -
      
      
    3. For Null Value, enter:

      -1
      
      
    4. Click Next.

  6. For Item Attributes, accept the defaults and click Next.

  7. On Source, for Default, enter:

    -1
    
    
  8. Click Create Item.

To create an item for Status.

  1. Under Items, click the Create icon.

  2. For Select Item Type, select Select List and click Next.

  3. For Select List Control Type, accept the default selection Select List and click Next.

  4. On Display Position and Name:

    1. For Item Name, enter P6_STATUS.

    2. For Region, select Issue Report Parameters.

    3. Click Next.

  5. On Identify List of Values:

    1. For Named LOV, select STATUS.

    2. For Null Text, enter:

      - All -
      
      
    3. For Null Value, enter:

      -1
      
      
    4. Click Next.

  6. For Item Attributes, accept the defaults and click Next.

  7. On Source, for Default, enter:

    -1
    
    
  8. Click Create Item.

To create an item for Priority.

  1. Under Items, click the Create icon.

  2. For Select Item Type, select Select List and click Next.

  3. For Select List Control Type, accept the default selection Select List and click Next.

  4. On Identify Item Name and Display Position:

    1. For Item Name, enter P6_PRIORITY.

    2. For Region, select Issue Report Parameters.

    3. Click Next.

  5. On List of Values:

    1. For Named LOV, select PRIORITIES.

    2. For Null Text, enter:

      - All -
      
      
    3. For Null Value, enter:

      -1
      
      
    4. Click Next.

  6. For Identify Item Attributes, accept the defaults and click Next.

  7. On Source, for Default, enter:

    -1
    
    
  8. Click Create Item.

To create an item for Related Project:

  1. Under Items, click the Create icon.

  2. For Select Item Type, select Select List and click Next.

  3. For Select List Control Type, accept the default selection Select List and click Next.

  4. On Identify Item Name and Display Position:

    1. For Item Name, enter P6_RELATED_PROJECT.

    2. For Region, select Issue Report Parameters.

    3. Click Next.

  5. On Identify List of Values:

    1. For Named LOV, select PRIORITIES.

    2. For Null Text, enter:

      - All -
      
      
    3. For Null Value, enter:

      -1
      
      
    4. Click Next.

  6. For Identify Item Attributes, accept the defaults and click Next.

  7. On Source, for Default, enter:

    -1
    
    
  8. Click Create Item.

Next, create a Go button. This button enables the user to execute the query once they select report parameters. Buttons can be created in region positions or displayed among items.

To create Go button:

  1. Under Buttons, click the Create icon.

  2. For Button Region, select Issue Report Parameters and click Next.

  3. For Button Position, select Create a button displayed among this region's items.

    This selection displays the button to the right of the last report parameter.

  4. click Next.

  5. For Button Attributes:

    1. For Button Name, enter P6_GO.

    2. For Button Style, select Template Based Button.

    3. For Template, select Button.

  6. Click Create Button.

    The Page Definition for page 6 appears.

Currently the items display stacked on top of one another. To use space more efficiently, change the position of P6_RELATED_PROJECT, P6_STATUS, and P6_PRIORITY so they display next to each other. Place P6_RELATED_PROJECT, P6_STATUS on the first line and P6_PRIORITY on the second line.

To change the position of 6_RELATED_PROJECT, P6_STATUS, and P6_PRIORITY:

  1. 1. Under the Page Rendering section, select the Items heading.

  2. For P6_RELATED_PROJECT, P6_STATUS, and P6_PRIORITY, select No for New Line.

  3. Click Apply Changes.

  4. Click the Edit Page icon in the upper right corner to return to the Page Definition for page 6.

Next, you need to modify the report to react to the parameters. To accomplish this, you need to modify the query's WHERE clause as follows:

WHERE (IDENTIFIED_BY = :P6_IDENTIFIED_BY OR 
       :P6_IDENTIFIED_BY = '-1')
   AND (RELATED_PROJECT = :P6_RELATED_PROJECT OR 
       :P6_RELATED_PROJECT = '-1')
   AND (ASSIGNED_TO = :P6_ASSIGNED_TO OR 
       :P6_ASSIGNED_TO = '-1')
   AND (STATUS = :P6_STATUS OR 
       :P6_STATUS = '-1')
   AND (PRIORITY = :P6_PRIORITY OR 
       :P6_PRIORITIY = '-1')

To use the preceding WHERE clause, you must convert the Issues region into a PL/SQL Function Body Returning a SQL Query.

To turn the Issues region into a PL/SQL Function Body Returning a SQL Query:

  1. Under Regions, select Issues.

  2. For Type, select SQL Query (PL/SQLfunction body returning SQL query).

  3. For Region Source, replace the existing statements with the following:

    DECLARE
    
       q VARCHAR2(32767); -- query
       w VARCHAR2(4000) ; -- where clause
       we VARCHAR2(1) := 'N'; -- identifies if where clause exists
    
    BEGIN
    
       q := 'SELECT "ISSUE_ID", '||
            ' "ISSUE_SUMMARY", '||
            ' "IDENTIFIED_BY", '||
            ' "RELATED_PROJECT", '||
            ' "ASSIGNED_TO", '||
            ' "STATUS", '||
            ' "PRIORITY", '||
            ' "TARGET_RESOLUTION_DATE", '||
    
            ' "ACTUAL_RESOLUTION_DATE" '||
            ' FROM "#OWNER#"."HT_ISSUES" '; 
    
       IF :P6_IDENTIFIED_BY != '-1'
          THEN 
          w := ' IDENTIFIED_BY = :P6_IDENTIFIED_BY ';
          we := 'Y';
       END IF;
    
       IF :P6_RELATED_PROJECT != '-1'
          THEN 
          IF we = 'Y'
             THEN 
             w := w || ' AND RELATED_PROJECT = :P6_RELATED_PROJECT ';
          ELSE
             w := ' RELATED_PROJECT = :P6_RELATED_PROJECT ';
             we := 'Y';
          END IF;
       END IF;
    
       IF :P6_ASSIGNED_TO != '-1'
          THEN 
          IF we = 'Y'
             THEN 
             w := w || ' AND ASSIGNED_TO = :P6_ASSIGNED_TO ';
        ELSE
             w := ' ASSIGNED_TO = :P6_ASSIGNED_TO ';
             we := 'Y';
        END IF;
       END IF;
    
       IF :P6_STATUS != '-1'
          THEN 
          IF we = 'Y'
             THEN 
             w := w || ' AND STATUS = :P6_STATUS ';
          ELSE
             w := ' STATUS = :P6_STATUS ';
             we := 'Y';
          END IF;
    END IF;
    
       IF :P6_PRIORITY != '-1'
           THEN 
           IF we = 'Y'
              THEN 
              w := w || ' AND PRIORITY = :P6_PRIORITY ';
           ELSE
              w := ' PRIORITY = :P6_PRIORITY ';
              we := 'Y';
           END IF;
       END IF;
    
       IF we = 'Y'
          THEN q := q || ' WHERE '|| w;
       END IF;
    
    RETURN q;
    
    END;
    
    
  4. Click Apply Changes.

Note that this function first sets the variable q to the original SELECT statement. It then builds a WHERE clause (w) composed of just the variables set by the user. If any variables have been set, it appends the WHERE clause to the original SELECT and passes that new SELECT to the database.

The report is now complete. Click the Run Page icon. (See Figure 10-10).

Figure 10-10 Issues Report

Description of Figure 10-10 follows
Description of "Figure 10-10 Issues Report"

To change the report parameters, make new selections under Issue Report Parameters and click Go.

Add a Page to Support Assigning Multiple Issues Simultaneously

Currently, you can assign an issue by editing it. Next, you add a new page 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:

  1. Navigate to the Application home page.