Oracle APEX – Save Selected Row IDs from Interactive Grid to a Page Item

sridhar utukurisridhar utukuri
2 min read

Sometimes you need to store the IDs of selected rows in an Interactive Grid so you can use them later in processes, validations, or dynamic actions.

In this guide, we’ll store selected IDs into a hidden page item called P4_SELECTED_PARTY_ID.

Click here to view example

1️⃣ What We Want to Do

When the user selects rows in the Interactive Grid:

  • The primary key values (usually an ID column) will be saved.

  • They will be stored in P4_SELECTED_PARTY_ID as a comma-separated list.

Example:
If you select two rows with IDs 123 and 456, the page item will contain:

123,456

2️⃣ Steps to Set It Up

  1. Open Page Designer for your page.

  2. Select your Interactive Grid region.

  3. In the Property Editor, go to Attributes.

  4. Find Initialization JavaScript Function.

  5. Paste this code:

     function (options) {
       options.defaultGridViewOptions = {
         selectionStateItem: "P4_SELECTED_PARTY_ID"
       };
       return options;
     }
    

    3️⃣ How It Works

    • selectionStateItem tells APEX to store the selected primary key values in the given page item.

    • The values are comma-separated.

    • You can use P4_SELECTED_PARTY_ID in:

      • Processes (e.g., to update multiple rows)

      • Validations (check if the user selected something)

      • Dynamic Actions (run something based on selected rows)

With this setup, you can easily use selected row IDs anywhere in your page logic.

🔗 Connect with Me

sridharutukuri@gmail.com | Linkedin | Github

Disclaimer

This content is based on my personal learning, experiments, and publicly available resources, including the Oracle APEX documentation and other community articles.
It is written for educational purposes only and reflects my own understanding and opinions.

This post is not affiliated with, endorsed by, or sponsored by Oracle, my current employer, or any organization I am associated with.

0
Subscribe to my newsletter

Read articles from sridhar utukuri directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

sridhar utukuri
sridhar utukuri