Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

APEX 23.1 Get IG record current values in loop while submitting page

kb9Dec 7 2023

Hi,

Use case: I have a master-detail page with two IGs (Invoice Header in master and Lines in detail). While submitting the page, need to check for each row in the Header (master IG), the corresponding sum of Line amount in all rows in detail IG matches else, throw an error. Note that we need to check the Line amount of the modified value in each row in detail grid and NOT what was queried when the page loads.

Problem: While iterating through the lines (code snippet below), we get the original value queried when the page is loaded and NOT the modified current value.

var invoiceLineAmount = 0;
var ig$ = apex.region("INVLINES").widget(); //INVLINES is static
var grid = ig$.interactiveGrid("getViews","grid");
var model = grid.model;
//Select all rows
ig$.interactiveGrid("getViews").grid.view$.grid("selectAll");
//Fetch selected records
var selectedRecordsLines = grid.view$.grid("getSelectedRecords");
for (idx2=0; idx2 < selectedRecordsLines.length; idx2++) {
record = model.getRecord(selectedRecordsLines[idx2][0]);
invoiceLineAmount = invoiceLineAmount + parseFloat(model.getValue(record,"LINE_TOTAL"));
}

In the above code, model.getValue(record,"LINE_TOTAL") gives the original value when the page was loaded and NOT the modified value. I need the modified value for each row in details grid and do the validation when the page is submitted. I can use this.triggeringElement.value to get the current value, but need to get modfied value in the above loop at the time of page submission.

Any help with the above code to get the modified value in the loop in page submission.

Thanks in advance.

This post has been answered by Karel Ekema on Dec 8 2023
Jump to Answer
Comments
Post Details
Added on Dec 7 2023
15 comments
796 views