Retrieving Values on Row Click in Oracle APEX Interactive Reports

Interactive reports serve as pivotal components in Oracle Application Express (APEX), offering users a dynamic platform to explore and interact with data. Implementing row click functionality allows users to extract specific information from rows effortlessly. In this guide, we’ll outline the steps to enable row click functionality on an interactive report, retrieving the value of a particular column. Let’s get started.

Step 1: Setting Up

  1. Assign a Static ID: Begin by assigning a static ID to the relevant HTML element. For instance, designate the static ID as “my_static_id”.
  1. Add Static ID to Column: Within the interactive report, assign a static ID to the column from which you wish to retrieve data. Let’s use “ENAME” as an example.
  • Creating the Page Item: To hold the value extracted from the row click, create a page item named “P5_ENAME”

Step 2: Creating the Dynamic Action

  1. Navigate to Dynamic Actions: Access the dynamic actions section in Oracle APEX.
  2. Create a New Dynamic Action: Initiate a new dynamic action, selecting the “Click” event on jQuery Selector #my_static_id td.
  1. Define Action Parameters: Specify the action details within the dynamic action setup.
  2. Select Action Type: Choose “Execute JavaScript Code” as the action type.
  3. JavaScript Implementation:
apex.item("P5_ENAME").setValue($(this.triggeringElement).closest('tr').find('td[headers="ENAME"]').text())
  1. Customize the JavaScript code by replacing “my_static_id” with the actual static ID assigned to the HTML element and “ENAME” with the static ID of the target column.

Step 3: Testing

  1. Save and Validate: Save the dynamic action configuration.
  2. Test the Functionality: Click on a row within the interactive report to ensure the JavaScript code executes correctly, logging the value of the specified column to the browser console.

Conclusion

Enabling row click functionality in interactive reports enhances user experience and facilitates seamless data extraction. By following the outlined steps, you can effortlessly implement this feature in Oracle APEX applications, empowering users to interact with data more intuitively. Should you encounter any issues, verify the implementation of JavaScript code and debug using browser developer tools. Happy coding!