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!

Total Sum of Col in IG

DernbauerJan 7 2023

Hello,
I wrote JS to compute the sum of a column(C006) in a IG. The aim is to set the last edited column to a value so that the sum of all columns should not have mor then 100, because it is the percentage of the Industry a company can have.

The IG is based on a Apex Collection. The script is executed by a DA on "Lose Focus"
image.png
and works as follows:
var widget = apex.region('Industries_SID').widget();
var grid = widget.interactiveGrid('getViews','grid');
var model = grid.model;
var val =0, total =0;

model.forEach(function(func) {
val = Number(model.getValue(func,"C006"));

console.log('this is '+val);
total += val;
});

alert(total);

It works well, more or less, the problem is, if I have initial values:
image.pngAnd if I change on Value
image.pngit is still 100. but it should be 60 in this case.

Any ideas what I did wrong ?

KR

Comments
Post Details
Added on Jan 7 2023
4 comments
861 views