Previous
Previous
 
Next
Next

Displaying Items as Select Lists

In this exercise, you edit fields (items) on the Create/Edit Employee page to display as select lists. Select lists are drop-down lists that contain lists of values that users can select to populate a field in the application. Displaying items as select lists consists of two general steps:

  1. Create the list of values (LOVs) for each item.

  2. Edit the item to display as a select list and reference the appropriate list of values you created.

Topics:

Creating Lists of Values

Next, you create lists of values for jobs, employees, and departments.

Creating a List of Values for Jobs

To create a list of values for jobs:

  1. Click Application on the Developer toolbar (at the bottom of the page).

  2. Click 4 - Create/Edit Employee.

  3. Under Shared Components, Lists of Values, click the Create icon. The Create icon resembles a plus sign (+) that overlaps a small page.

    Description of bldapp_criconlov.gif follows
    Description of the illustration bldapp_criconlov.gif

    The Create List of Values Wizard appears.

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

  5. For Name and Type:

    1. Name - Enter JOBS.

    2. Type - Select Dynamic.

    3. Click Next.

  6. For Query or Static Values, replace the existing text with this:

    SELECT job_title d, job_id v
        FROM oehr_jobs
        ORDER BY d
    

    Note that the first column selected is the one displayed to the user (d), and the second is the value stored in or retrieved from the database (v).

  7. Click Create List of Values.

    Shared Components do not appear on this Page Definition until they are explicitly added to this page. You add them later in this tutorial.

Creating a List of Values for Employees

To create a list of values for employees:

  1. Under Lists of Values, click the Create icon.

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

  3. For Name and Type:

    1. Name - Enter EMPLOYEES.

    2. Type - Select Dynamic.

    3. Click Next.

  4. For Query or Static Values, replace the existing text with this:

    SELECT first_name ||' '|| last_name d, employee_id v
        FROM oehr_employees
        ORDER BY last_name
    
  5. Click Create List of Values.

Creating a List of Values for Departments

To create a list of values for departments:

  1. Under Lists of Values, click the Create icon.

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

  3. For Name and Type:

    1. Name - Enter DEPARTMENTS.

    2. Type - Select Dynamic.

    3. Click Next.

  4. For Query or Static Values, replace the existing text with this:

    SELECT department_name d, department_id v
        FROM oehr_departments
        ORDER BY d
    
  5. Click Create List of Values.

Editing Items to Display as Select Lists

After you create the lists of values, edit these items so they display as select lists. By default, the items display as text fields.

You also rename the P4_JOB_ID, P4_MANAGER_ID, and P4_DEPARTMENT_ID items.

To edit the job item:

  1. Under Page Rendering, scroll down to the Items section.

    Description of item_sect.gif follows
    Description of the illustration item_sect.gif

    Notice that the Items section lists all the items for this page. Currently all but two items show the default type of Text field.

  2. Click P4_JOB_ID.

    The Edit Page Item page appears.

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

  4. Under Label, change Label to Job.

  5. Scroll down to List of Values.

  6. From Named LOV, select JOBS.

  7. Click Apply Changes.

To edit the manager item:

  1. Under Items, click P4_MANAGER_ID.

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

  3. Under Label, change Label to Manager.

  4. Under List of Values:

    1. Named LOV - Select EMPLOYEES.

    2. Display Null - Select Yes.

    3. Null display value - Enter the following:

      - No Manager Assigned -
      

    Note that you did not include this information for Jobs because the Job column is mandatory. For optional columns, such as Manager and Department, specify that the select list display a null record. You can also provide meaningful text to display to the user when this situation occurs.

  5. Click Apply Changes.

To edit the department item:

  1. Under Items, select P4_DEPARTMENT_ID.

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

  3. Under Label, change Label to Department.

  4. Under List of Values:

    1. Named LOV - Select DEPARTMENTS.

    2. Display Null - Select Yes.

    3. Null display value - Enter the following:

      - No Department Assigned -
      
  5. Click Apply Changes.

  6. Run the page.

    Description of bldap_empeditfrm_lst.gif follows
    Description of the illustration bldap_empeditfrm_lst.gif

    In the form, note that the Job, Manager, and Department fields now display as select lists.