Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To calculate the sum of values in a selected row of an interactive grid in Oracle Apex, you can follow these steps:

  1. Add a button to the interactive grid region and set its action to "Execute JavaScript Code".
  2. In the JavaScript code section, write the following code:
var grid = apex.region("interactive_grid_region_id").widget().interactiveGrid("getViews", "grid"); // Replace "interactive_grid_region_id" with the ID of your interactive grid region. var selectedRowData = grid.getSelectedRecords()[0]; // Get the data of the selected row. var totalSum = 0; Object.keys(selectedRowData).forEach(function(columnName) { var columnValue = selectedRowData[columnName]; if (!isNaN(columnValue)) { // Check if the value is a number. totalSum += parseFloat(columnValue); } }); alert("Total sum: " + totalSum); // Display the total sum in an alert box. 
  1. Replace "interactivegridregion_id" with the ID of your interactive grid region.
  2. Add the button to the selected row actions of the interactive grid.
  3. Run the page and select a row. Click on the button on the selected row and the total sum of the row's values will be displayed in an alert box.