Introduction
In Oracle APEX, creating a user interface that allows users to move data from a left panel to a right panel—commonly known as a dual list or shuttle component—is a practical way to handle multi-selection and assignment tasks. Whether you're building a form to assign roles to users or selecting multiple items from a list, implementing this feature improves usability and keeps the page clean and interactive. Oracle APEX provides built-in components and dynamic actions to make this functionality simple to implement.
How to Move Data from Left Panel to Right Panel in Oracle APEX
To create a dual-panel interface where users can move data from the left list to the right:
-
Create a Shuttle Item
-
Go to your APEX Page Designer.
-
Add a new Item to the page.
-
Set the Type to Shuttle.
-
Under the List of Values section, define a LOV Query that retrieves values for the left panel.
SELECT ROLE_NAME d, ROLE_ID r FROM APP_ROLES ORDER BY ROLE_NAME
-
This query should return the display label (
d
) and return value (r
).
-
-
Define Save Logic
-
The shuttle item stores the selected values (those in the right panel) as a colon-separated string.
-
To process these values in PL/SQL (e.g., to insert into a table), use a loop:
FOR i IN 1 .. apex_util.string_to_table(:P1_SHUTTLE_ITEM).COUNT LOOP INSERT INTO USER_ROLES (USER_ID, ROLE_ID) VALUES (:P1_USER_ID, apex_util.string_to_table(:P1_SHUTTLE_ITEM)(i)); END LOOP;
-
-
Optional: Filter the Left Panel Values
-
If you want to exclude values already selected or assigned, modify your LOV query to filter out those already in the right panel.
-
-
Customize with Dynamic Actions (Optional)
-
Add Dynamic Actions to refresh the shuttle or handle additional logic when selections change.
-
You can also use
apex_item.select_list_from_query_xxx
functions in classic reports if you prefer building a fully custom interface.
-
-
Styling and Usability
-
Shuttle items support template options, so you can change width, label positioning, and spacing.
-
Add instructions above the shuttle so users understand how to interact with it.
-
Select Master Detail
Select the table
Select the kind of report
Name the page
Identify the table that you want to work with
This is the result:
Conclusion
Moving data from a left panel to a right panel in Oracle APEX is a powerful way to handle multiple selections in a clean, user-friendly format. The shuttle item simplifies this process, allowing developers to implement it with minimal code while still supporting flexible logic and customization. With proper LOVs and PL/SQL handling, this component makes it easy to manage assignments, roles, and any other selection-based tasks in your APEX applications.
No comments:
Post a Comment