Pages

Sunday, May 23, 2010

Step 10 – Apex Developer Day - 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 5 - Master Detail page.

clip_image002

2.

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

clip_image006

3.

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

clip_image008

4.

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

clip_image010

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 (clip_image012) icon.

clip_image014

6.

Click the Tables tab.

clip_image016

7.

Select the APEX_EMPLOYEES table link.

clip_image018

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.

clip_image020

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 APEX_EMPLOYEES

order by 1

clip_image022

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 (clip_image004[1] ) icon again.

clip_image023

11.

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

clip_image008[1]

12.

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

clip_image025

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.

clip_image027

14.

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

clip_image029

15.

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

clip_image008[2]

16.

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

clip_image031

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.

clip_image033

18.

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

clip_image037

19.

Click the Show All icon to reveal all Page Components.

clip_image039

20..

In the Regions area, click the Report link.

clip_image041

21.

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

clip_image045

22.

Click the Tabular Form Element section button.

clip_image047

23.

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

clip_image049

clip_image051

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.

clip_image053

25.

Click the Edit (clip_image043[1])icon in front of the STATUS column.

clip_image055

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.

clip_image057

27.

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

clip_image059

clip_image061

28.

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

clip_image065

29.

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

clip_image067

NOTE: In case the APEX TAKS do not show up as the screen above, Please Click Projects

clip_image069

Edit any Project, as example Maintain Satisfaction Survey

clip_image071

We will see the page completed

clip_image072

30.

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

clip_image074

31.

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

clip_image076

32.

Under Page Rendering, click the item (clip_image078) icon.

clip_image080

33.

Select P5_PROJECT_PRIORITY.

clip_image082

34.

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

clip_image084

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.

clip_image086

36.

Click Run.

clip_image088

37.

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

clip_image090

NOTE: Only In case the APEX TASKS do not show up as the screen above, Please Click Projects

clip_image069[1]

Edit any Project, as example Maintain Satisfaction Survey

clip_image071[1]

We will see the page completed

clip_image090[1]

No comments:

Post a Comment