Ask Your Question
3

How can the sum of a selected row's values be calculated in the interactive grid of Oracle Apex?

asked 2023-07-09 07:45:25 +0000

qstack gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-07-09 07:55:02 +0000

devzero gravatar image

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.
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-07-09 07:45:25 +0000

Seen: 11 times

Last updated: Jul 09 '23