Oracle® Application Express Advanced Tutorials Release 3.2 Part Number E11945-02 |
|
|
PDF · Mobi · ePub |
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:
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:
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".
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".
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. |
||
2 - Projects |
Home |
Project report page used to display and search projects. Links to Project Details page. |
|
3 - Project Details |
Projects |
Project details form used to view details for a specific project and to add, delete, and edit a project. |
|
4 - Users |
Home |
Users report page used to display and search users. Links to User Information page. |
|
5 - User Information |
Users |
User information form used to view information for a specific user and to add, edit and delete a user. |
|
6 - Issues |
Home |
Issues report page used to display and search Issues. Links to Issue Details page. |
|
7 - Issue Details |
Issues |
Issue Details form used to view information for a specific issue and to add, edit and delete an issue. |
|
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. |
|
9 - Issue Summary by Project |
Reports |
Provides a report of a variety of issue parameters per project. |
|
10 - Resolved by Month Identified |
Reports |
Shows a visual depiction number of issues solved each month. |
|
11 - Target Resolution Dates |
Reports |
Displays a calendar with entries for each target resolution date. |
|
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. |
|
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. |
|
18 - Dashboard |
Home |
A snapshot of Overdue Issue, Unassigned Issues, Recently Opened Issues, and Open Issues by Project is displayed. |
|
101 - Login |
Application login page. |
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:
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:
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.
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.
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.
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.
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
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:
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.
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
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:
Note:
If you are already familiar with this application, skip "Overview of Project Pages" and proceed to "Create a Tab Set for this Application".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-7 Project Details Page When Adding a Project
Figure 15-8 Project Details Page When Editing a Project
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.
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.
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.
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.
The fields on the Projects page need to be edited and the name of the Create button needs to be changed to Add Project.
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.
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.
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.
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.
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.
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.
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.
Click the Projects link under the second image. The Project page should look similar to Figure 15-11.
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
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.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:
Note:
If you are already familiar with this application, skip Overview of User Pages and proceed to "Create Pages for Maintaining Users".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-14 User Information Page for George Hurst
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.
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.
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.
To preview your page, click Run Page. As shown in Figure 15-15, notice the newly created report displays the demo data.
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".
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.
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.
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.
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.
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.
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.
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.
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:
Click Create List of Values.
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.
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.
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.
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.
Click the Users link to the far right. The Users page will be displayed and will look similar to 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
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.
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.
Now you need to create pages to retrieve issue information from IT_ISSUES
.
Topics in this section include:
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".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".
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.
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.
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.
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.
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:
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.
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.
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.
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
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.
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
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
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
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
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.
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.
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.
To see the changes, click the Run Page icon. The new form appears as shown in 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.
Next, you refine the Issues report page to support dynamic modification of the query. To accomplish this, you must:
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.
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.
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.
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.
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
Select Select Columns. Your page should look similar to Figure 15-33.
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
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.
Click the Issues breadcrumb to go back to the Issues page.
Click the Add Issue> button. An empty Issue Details page should appear.
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:
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".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-37 Issue Summary By Report and Assign Open Issues
Figure 15-38 Target Resolution Dates and Average Days to Resolve
Figure 15-39 Resolved by Month Identified
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.
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.
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 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
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.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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.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.
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.
To view your newly created bar chart, click Run Page. Your report should resemble Figure 15-45.
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:
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".
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.
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.
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.
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 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
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 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.
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 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
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.
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
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:
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:
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
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
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.
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.
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".
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
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:
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
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.
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.
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
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.
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:
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:
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.
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.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
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 DBAWhen 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 GuideSee Also:
Security How To documents on OTN:http://www.oracle.com/technology/products/database/application_express/howtos/howtos.html
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.
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.