Search This Blog

Showing posts with label CREATING A STATIC LIST OF VALUES in ORACLE APEX. Show all posts
Showing posts with label CREATING A STATIC LIST OF VALUES in ORACLE APEX. Show all posts

Friday, July 18, 2025

CREATING A STATIC LIST OF VALUES in ORACLE APEX

Introduction

In Oracle APEX, Lists of Values (LOVs) are used to populate dropdowns, radio groups, checkboxes, and other selection-based items with predefined choices. One common type of LOV is the Static LOV, where all values are manually defined by the developer. Static LOVs are simple, efficient, and very useful when the value list is small and rarely changes — for example, predefined statuses like "Active" or "Inactive". In this guide, we’ll walk through the process of creating a static LOV in Oracle APEX, show where and how to use it, and provide best practices and examples to help you build robust, maintainable forms.

How to Create a Static List of Values – Step-by-Step

  1. Log into Oracle APEX

    • Navigate to your APEX application.

    • Open the page where you want to use the LOV, or create a new one.

  2. Create the Item That Will Use the LOV

    • In the Page Designer, click on the region or form where you want to add the item (e.g., a select list).

    • Under the Items node, click + and choose Select List, Radio Group, or Checkbox Group, depending on how you want to display the LOV.

  3. Define the Static LOV

    • Select the item you just created.

    • In the Property Editor, under the List of Values section:

      • Set Type to Static Values.

      • Click the Edit icon next to Static Values to open the LOV editor.

  4. Enter Static LOV Entries
    In the dialog, you’ll define each entry using:

    • Display Value – the value shown to the user.

    • Return Value – the value stored in the database or submitted to the process.

    Example 1 – Status Options

    Display Value        | Return Value
    ---------------------|-------------
    Active               | A
    Inactive             | I
    Pending            | P
    

    You can enter them directly in the LOV editor like this:

    Active;A
    Inactive;I
    Pending;P
    

    Example 2 – User Roles

    Administrator;ADMIN
    Manager;MGR
    Employee;EMP
    
  5. Use the LOV in Forms or Filters
    Once defined, the LOV will automatically populate your item. When the page runs, users will see the Display Value, and when they submit the form, the Return Value will be stored or processed.

Extensive Example – Using Static LOV in a Form

Suppose you have a form for creating user accounts, and you want the user to choose a role.

  1. Create an item called P1_USER_ROLE.

  2. Set its Type to Select List.

  3. In the Static Values field, enter:

    Admin;A
    Editor;E
    Viewer;V
    
  4. Use :P1_USER_ROLE in your form's insert process like this:

    INSERT INTO users (username, role)
    VALUES (:P1_USERNAME, :P1_USER_ROLE);
    


One way to create a static list of values is to edit an item's List of Values definition. Note that this type of list of values is not reusable. As a best practice, create a list of values as a shared component whenever possible.

To create a static list of values:

  1. View the page in Page Designer:

    1. On the Workspace home page, click the App Builder icon.

    2. Select an application.

    3. Select a page.

Page Designer appears.

  1. Create a new item from the Rendering tab or by adding it from the Gallery.

The Property Editor displays the Page Item attributes. Attributes are organized in groups.

Tip:

To find a group or attribute, enter keywords in the Filter Properties field. The Property Editor displays the group or attributes. Or, you can click Go to Group and select the group.

  1. Edit the appropriate attributes in the Property Editor.

Tip:

To learn more about an attribute, select the attribute in the Property Editor and click the Help tab in the center pane.

  1. Under Identification:

    1. Name - Enter the name of this item. Item names must be valid Oracle identifiers. Oracle recommends that item names be no longer then 30 bytes so they can be used as bind variables in SQL Queries.

    2. Type - Select Select List.

  2. Under List of Values:

    1. Type - Select Static Values.

    2. Static Values - Click the Display1, Display2 button.

In the Static Values dialog:

  • Display Value - Enter the Display Value for each entry.

  • Return Value - Enter the Return Value for each entry. If you do not include a Return Value, the return value equals the Display Value

  • Move Up and Move Down - Click the Move Up and Move Down arrow buttons to change the order.

  • Sort - To sort the list at alphabetically at runtime, expand the Sort region and enable Sort at Runtime.

Tip:

See the sections that follow to view examples.

  1. Click OK.

  1. Edit the remaining List of Values attributes as appropriate. To learn more about an attribute, select the attribute and click the Help tab in the central pane.

  2. To save your changes click Save. To save and run the page, click Save and Run Page.

Example 13-1 Four Values Displayed in Alphabetical Order

This example shows the Static Values dialog with four values defined: Lion, Dog, Cow, and Cat. The return value of each entry is capitalized. Sort at Runtime is set to On so that the list displays alphabetical order.


Description of the illustration static_four_values.png

In a running application this select list would look similar to the following illustration.

A blue and white rectangular object

Description automatically generated
Description of the illustration static_4_values_run.png

Example 13-2 Values Displayed in the Order Listed

This example shows the Static Values dialog with ten values defined: 10, 15, 20, 25, 50, 100, 200, 500, 1000, and 10000 which display in the order listed. The return value of each entry equals the display value.


Description of the illustration static_10_values.png

In a running application this select list would look similar to the following illustration.

A screenshot of a computer

Description automatically generated
Description of the illustration static_10_values_run.png

Example 13-3 A List of Values with Having Both a Return and Display Value

This example shows the Static Values dialog with two values defined. The first value has a Display Value of Yes and a Return Value of Y. The second value has a Display Value of No and a Return Value of N Sort at Runtime is set to Off to make sure Yes always displays first.


Description of the illustration static_display_return.png

In a running application this select list would look similar to the following illustration.

A computer screen shot of a blue stripe

Description automatically generated
Description of the illustration static_display_return_run.png

See Also:

Creating Lists of Values at the Application-Level and About Item Naming Conventions

Best Practices

  • Use static LOVs only when values are fixed and rarely change. If the list changes frequently, use a dynamic LOV based on a table or SQL query.

  • Make return values meaningful. Use short codes like 'A' for Active or 'E' for Editor to save storage and simplify processing.

  • Avoid hardcoding values in multiple places. If the same LOV is used in many places, create a shared LOV at the application level (Shared Components).

  • Include a NULL display entry like - Select - ; if the field is optional.

  • Keep values sorted to improve user experience.

Oracle APEX Documentation Link
For more details on Lists of Values:
Oracle APEX – LOV Documentation

Conclusion
Creating a static List of Values in Oracle APEX is straightforward and highly useful for building clean, user-friendly interfaces. It allows you to define fixed choices for form inputs, ensuring consistency in data entry and improving overall application usability. When used correctly, static LOVs simplify your application logic and contribute to a better end-user experience. For small, stable sets of options, static LOVs are the ideal choice.

How Do I Make a Faceted Search Map Page in Oracle APEX

Combining faceted search with a map region in Oracle APEX enables users to filter data visually and spatially at the same time. This design ...