Creating and Running an Application

Purpose

This tutorial shows you how to rapidly create an application using Oracle Application Express.

Time to Complete

Approximately 45 minutes

Topics

This tutorial covers the following topics:

 Overview
 Prerequisites
 Creating an Application
 Editing Application Objects
 Creating Lists of Values (LOVs)
 Adding an Item Validation
 Summary

Viewing Screenshots

 Place the cursor over this icon to load and view all the screenshots for this tutorial. (Caution: This action loads all screenshots simultaneously, so response time may be slow depending on your Internet connection.)

Note: Alternatively, you can place the cursor over an individual icon in the following steps to load and view only the screenshot associated with that step. You can hide an individual screenshot by clicking it.

Overview

In this tutorial, you create an application and edit some of the objects. You will create a few list of values and assign them to a page. Then you will add a validation for an item.

Back to Topic List

Prerequisites

Before you perform this tutorial, you should:

1.

Perform the Manipulating Database Objects tutorial.

Back to Topic List

Creating an Application

To create the application framework and default a few initial pages, perform the following steps:

1.

From the Oracle Application Express home page, click the down arrow next to Application Builder > Create Application.

 

2.

Select Create Application and click Next.

 

3.

For Name, enter Project Tasks Application. Keep the default value of From Scratch for the Create Application, and click Next >.

 

4.

Enter Home for Page Name and click Add Page.

 

5.

You see the Master Detail page type. Master Detail builds a two page report and form combination. Select Master Detail for Page Type. Select Home(1) for Subordinate to Page, OBE_PROJECTS for Master Table Name, and OBE_TASKS for Detail Table Name. Click Add Page.

 

6.

The Master Detail pages were created, click Next.

 

7.

Accept the default and click Next.

 

8.

Accept the default and click Next.

 

9.

You can define a date format that will be used throughout your application. This date format will be used to alter the NLS_DATE_FORMAT database session setting prior to showing or submitting any page within the application. This format is used by all reports showing dates and is also picked up by form items of type 'Date Picker (use Application Date Format)'. This can be set using:

  1. Application Builder > Application Builder Defaults (under Tasks): These are specific to a Workspace, not a developer, and will be used as the default when using the create application wizard.
  2. Application Builder > Create Application Wizard > Attributes page
  3. Application Builder > Your Application > Shared Components > Edit Globalization Attributes.

Select an Application Date Format for your Application and click Next.

 

10.

Select Theme 20 and click Next.

 

11.

Click Create.

 

12.

Your application was created successfully. Click Run Application.

 

13.

Because you chose the default of Application Express Authentication, you need to login to the new application using the same login you use to develop. Enter obe for the User Name and oracle for the Password. Then click Login.

 

14.

Select OBE Projects.

 

15.

A report containing the list of projects is automatically created. Select the Edit (  )icon next to one of the projects to view the Master detail Form.

 

16.

The Master Detail Form is shown. This page allows a user to edit the details of the Project as well as the details of the Tasks associated with the Project. It also allows users to add new tasks to the current project.

In the detail region, you see an Add Row button. This button saves any pending changes and then adds another row so that a new task can be added to the project. You should also have a Delete Checked button. This button is used in conjunction with the check boxes to the left of each Task. When you click the Delete Checked button, any tasks that have been "checked" are deleted. If you use this feature, you notice that a deletion confirmation has been built in. This asks you to confirm your deletion before proceeding.

Change the name of the project and click Apply Changes.

 

Back to Topic List

Editing Application Objects    

Although the Master-Detail form is fully functional, the presentation can be improved. In this topic you change the names of the Page Title, Region Title and change the format an item on the Master Report. Additionally, you print the Projects report in the PDF format. Lastly, you change the sequence of items in the Projects and Tasks page using the Drag and Drop feature. Perform the following steps:

1.

Select Edit Page 2.

 

2.

Select the Report link under Regions.

 

3.

Click the Edit (  ) icon next to PROJECT_DEADLINE.

 

4.

Under Column Formatting, enter MM/DD/YYYY for the Number/Date Format field and click Apply Changes.

 

5.

Click Apply Changes.

 

6.

Click the Edit Page Attributes (  ) icon for the Page.

 

7.

In the Name section, enter Projects for the Name. In the Display Attributes section, enter Projects for the Title. Then click Apply Changes.

 

8.

Click Run.

 

9.

Notice that the Title in your Browser is set to Projects and the format of the PROJECT_DEADLINE has changed. You notice that the Region title is still set to Obe Projects. Click Show Edit Links in the Developer links area.

 

10.

Click the Edit (  ) icon next to the Obe Projects Region title.

 

11.

Change the title to Projects and click Apply Changes.

 

12.

Click Cancel to close the Page Region window.

 

13.

Refresh your browser to show the change you just made. Click Hide Edit Links in the Developer Links.

 

14.

Click the Edit Page 2 link in the developer tool bar.

 

15.

Click the Report link next to the Projects region.

 

16.

Click the Print Attributes tab.

 

17.

Select Yes in the Enable Report Printing drop-down menu and select Portrait in the Orientation drop-down menu under Page Attributes. Then click the Page Header tab.

 

18.

Enter Project Report for Page Header and and set the Alignment to center. Click Apply Changes.

 

19.

Notice that now Print appears to the right of the Report link since you have enabled Report Printing. Click Run.

 

20.

Notice the Print link at the bottom of the report. Click the Print link.

 

21.

Click the Open with radio button and click OK to view the report in PDF format.

 

22.

The Projects report is displayed in the PDF format. Note that if you receive an error, BI Publisher is probably not started. Select Start > Programs > Oracle - BI Publisher > Start BI Publisher.

 

23.

Click the Edit Page 2 link in the developer tool bar.

 

24.

Click the > arrow to navigate to the page definition for the Projects and Tasks page (Page 3).

 

25.

The page definition for Page 3 is displayed. To reorder the sequencing of items in this page, click the Items tab.

 

26.

Click the Drag and drop icon in the Items section.

 

27.

The Drag and Drop layout is displayed. You can use this intuitive graphical layout to edit, create, or delete items in this page.

 

28.

In order for the Project Priority item to appear above Project Deadline item in Page 3, drag and drop the P2_PROJECT_ PRIORITY item above the P2_PROJECT_ DEADLINE item and click Next>. Note that you may need to add a new row and then drag and drop the item.

 

29.

Click Apply Changes.

 

30.

Click Run.

 

31.

Note how the Project Priority field now appears above the Project Deadline field. Click the Application <n> link in the developer tool bar.

 

Back to Topic List

Creating Lists of Values (LOVs)

Another way to improve the presentation of the application is to create a List of Values. In this topic, you create the following LOVs:

EMPLOYEES A Dynamic LOV to show the list of Employees. This LOV is then associated with the Assigned To column in the List of Tasks.
STATUSES A Static LOV to show the list of Statuses. This LOV is then associated with the Status column in the List of Tasks.
PRIORITIES A Static LOV to show the list of Priorities. This LOV is then associated with the Priority column in the Projects Master area.

Perform the following steps:

1.

Click the 3 - Master Detail page.

 

2.

In the Shared Components column, under List of Values, click the Create (  ) icon.

 

3.

For Create List of Values, keep the default value From Scratch, and click Next >.

 

4.

For Name, enter EMPLOYEES. For Type, change the type to Dynamic. Then click Next >.

 

5.

For a dynamic LOV, you need to enter the SQL you want to execute when the page is rendered. To find out what the names of your columns are, you can select the item finder (  ) icon.

 

6.

Click the Tables tab.

 

7.

Select the OBE_EMPLOYEES table link.

 

8.

Note the names of the columns. You could select the SQL statement shown and copy this to the clipboard. Exit the Item Finder window.

 

9.

Change the SQL statement to the following and then click Create List of Values. The first column in a dynamic list of values is the column displayed to the user. The second column is the corresponding value to be stored in the database. They can both be the same value when appropriate.

                               
select FIRST_NAME||', '||LAST_NAME d,
    EMPLOYEE_ID r
from OBE_EMPLOYEES
order by 1
                            

 

10.

Your LOV was created. Note that the LOV is not listed in the List of Values area because you haven't yet associated it with this page. You want to create 2 more static LOVs. Click the Create (  ) icon again.

 

11. For Create List of Values, keep the default value From Scratch, and click Next >.

 

12.

Enter STATUSES for the Name and make sure Static is selected for the type and click Next >.

 

13.

For Display Value and Return Value, enter the following:

Display Value Return Value
Closed closed
Open open
On Hold on-hold

Click Create List of Values.

 

14. The STATUSES LOV was created. There is one more LOV to create for the Master portion of the form, Priorities. Click Create.

 

15. For Create List of Values, keep the default value From Scratch, and click Next >.

 

16.

Enter PRIORITIES for the Name and make sure Static is selected for the type and click Next >.

 

17.

For Display Value and Return Value, enter the following:

Display Value Return Value
High 1
Medium 2
Low 3

Click Create List of Values.

 

18. The PRIORITIES LOV was created. Now you can associate the LOVs with the page. Click the Edit Page 3 (  ) icon.

 

19. Click the Show All icon to reveal all Page Components.

 

20. In the Regions area, click the Report link.

 

21.

Click the Edit (  ) icon in front of the ASSIGNED_TO column.

 

22.

Click the Tabular Form Element section button.

 

23.

Change the Display As to Select List (named LOV) and click the List of Values section button.

 

24.

Select EMPLOYEES for the Named LOV, select YES for Display Null and enter - None Assigned - for the Null display value. Then click Apply Changes.

 

25.

Click the Edit (  ) icon in front of the STATUS column.

 

26.

The List of Values section button should be already selected. Select STATUSES for the Named LOV, Yes for Display Null and enter - No Status - for the Null display value. Then click the Tabular Form Element section button.

 

27.

Select Select List (named LOV) for the Display As and click Apply Changes.

 

28.

Now you can run the page again to see the results. Click Run Page 3 (  ) icon.

 

29.

Select the dropdown list for Assigned To. You see that the dynamic LOV executed and the list of Employees is shown.

 

30.

Select the dropdown list for Status. You see that the static LOV values are shown.

 

31.

Next, you need to assign the the PRIORITIES LOV to the Priority item in the Master area of the page. Click Edit Page 3 .

 

32.

Under Page Rendering, click the item (  ) icon.

 

33.

Select P3_PROJECT_PRIORITY.

 

34.

Select the Radio link under the Display As field and click the LOV section button.

 

35.

Select PRIORITIES for the Named LOV, enter 4 for Number of Columns, select Yes for Display Nulls and enter None for the Null display value. Then click Apply Changes.

 

36.

Click Run.

 

37.

The Priority field is now a Radiogroup populated with the LOV values. Click Edit Page 3 in the Developer links.

 

Back to Topic List

Adding an Item Validation   

You don't want a user entering a date prior to today's date. This type of check can be done through an item validation. Perform the following steps:

1.

Click the Create (  ) icon in the Validations section for Page 3.

 

2.

Accept the default to create an Item level validation and click Next >.

 

3.

Select the item P3_PROJECT_DEADLINE and click Next >.

 

4.

Select SQL for the Validation Method and click Next >.

 

5.

Because you want to specify the condition when a PROJECT_DEADLINE is incorrect, click SQL Expression and click Next >.

 

6.

Enter P3_PROJECT_DEADLINE as Validation Name and click Next >.

 

7.

Enter TO_DATE(:P3_PROJECT_DEADLINE,'MM/DD/YYYY') >= SYSDATE for the Validation and Date needs to be greater than today for the Error Message and click Next >.

 

8.

Select Request Is Contained within Expression1 for the Condition Type and enter SAVE, CREATE for Expression1. Then click Create.

 

9.

The validation has been created successfully. Click Run.

 

10.

Change the date to something prior to today's date and click Apply Changes.

 

11.

Notice that you receive an item (or field) error message as well as a page notification message. This is because you specified that you wanted both when you created the validation.

 

12.

Click the Application <n> link in the developer tool bar.

 

Summary

In this tutorial, you learned how to:

 Create an application
 Edit Application Objects
 Create List of Values (LOVs)

Back to Topic List

 Place the cursor over this icon to hide all screenshots.

 

Left Curve
Popular Downloads
Right Curve
Untitled Document