Database Developer
BROWSER-BASED B Y DAVID PEAKE
Extend Your Applications
Use plug-ins with Oracle Application Express 4.0
to add custom components.
ORACLE APPLICATION EXPRESS 4.0
Oracle Application Express 4.0 intro- duced a plug-in architecture that
enables developers to extend their applications with custom item and region types,
processes, and dynamic actions. Several
plug-ins are free for downloading from
Oracle Technology Network, and more than
40 plug-ins developed by members of the
Oracle Application Express community are
available from an external Website.
This column walks you through building
an application that implements and uses
three existing plug-ins. You can run through
these steps on the hosted instance of Oracle
Application Express 4.0 at apex.oracle.com.
(You must request a free workspace to use
this hosted instance.) You can also use a
local instance of Oracle Application Express
4.0. This exercise is based on the EMP table,
which is available by default in the database.
appeal to the demonstration application.
With the EMP table still open in the Object
Browser, follow these steps:
Click
1. UI Defaults on the menu.
Click
2. Edit.
Click
3. EMPNO in the table to open the
Column Defaults page for the EMPNO
column.
Under General Defaults, replace
4. EMPNO
in the Label field with Employee Number
and then click Apply Changes.
Repeat the preceding step to change the
5.
labels for the ENAME, MGR, HIREDATE,
SAL, COMM, and DEPTNO columns to,
respectively, Employee Name, Manager,
Hire Date, Salary, Commission, and
Department.
For
4. Page Type, select Report and Form.
Enter EMP for Table Name, click Add Page,
and click Create.
On the summary page, click
5. Create.
Next you’ll install two plug-ins into the
Employees application that will help users
input data easily into the application’s
Phone Number and Rating fields. You’ll also
install a plug-in that generates an employee
organization chart and adds it to the application’s report page.
MODIF YING THE EMP TABLE
You’ll build a database application that
enables users to view and edit employee data.
Before you create the application, you need to
add two new columns to the EMP table and
change some user interface defaults. Log in to
Oracle Application Express, and follow these
steps to add PHONE_NUMBER and RATING
columns to the EMP table:
From the Oracle Application Express
1.
home page, select SQL Workshop ->
Object Browser.
Select the
2. EMP table from the list.
Click
3. Add Column. Enter PHONE_NUMBER
for Add Column, change its Datatype to
VARCHAR2, enter
14 for Length, click
Next, and click Finish.
Select the
4. EMP table from the list again.
Click
5. Add Column, enter RATING for Add
Column, enter
1 for Precision, click Next,
and click Finish.
Now you’ll change some of the EMP
table’s column labels to add some visual
CREATING THE DEMONS TRATION
APPLICATION
To create the demonstration application,
follow these steps:
From the Oracle Application Express
1.
home page, select Application Builder.
Click
2. Create. For Application Type, select
Database and From Scratch.
For
3. Name, enter Employees, and then
click Next.
DO WNLOADING AND INS TALLING
PLUG-INS
Download the following plug-ins from Oracle
Technology Network at oracle.com/
technetwork/developer-tools/apex/
plugins-155231.html, and unzip them to a
convenient location on your system:
Masked Text. • This item-type plug-in makes
it easy for users to enter fixed-width,
formatted data (such as dates, phone
numbers, and Social Security numbers).
Star Rating. • This item-type plug-in enables
your application’s users to rate something
by clicking a star icon representing a rating
in any range from 0 to 99, inclusive.
Next, download and unzip the Google
Organization Chart
KING7839 President
BLAKE
7698
Manager
CLARK
7782
Manager
JONES
7566
Manager
ALLEN
7499
Salesman
WARD
7521
Salesman
MARTIN
7654
Salesman
TURNER
7844
Salesman
JAMES
7900
Clerk
MILLER
7934
Clerk
SCOT T
7788
Analyst
FORD
7902
Analyst
ADAMS
7876
Clerk
SMITH
7369
Clerk
Figure 1: Organization chart generated by the Google OrgChart plug-in
ORACLE MAGAZINE JANUARY/FEBRUAR Y 2011