Good Afternoon Community,
I am using Oracle APEX 5.1.0.00.45 with Google Chrome and PLSQL Developer 12c
I would like to Add Negative Numbers in Interactive Grid ....currently the Grid Works flawlessly with adding Numbers but when I add a ( - ) dash or Negative sign I get NaN when I alert out the Variable.
Here is the Function I'm Using to Loop Through Interactive Grid and Add up what is in the AMOUNT Column and sets the Result to a Page Item on the Page (P234_DTL_AMOUNT)AMOUNT)
Now the End-Users need to enter Negative Amounts for Credits they Receive Back
function addTransActionsDtl() {
var model = apex.region("transdtl").widget().interactiveGrid("getViews", "grid").model;
var EtotalKey = model.getFieldKey("AMOUNT");
var totamt = 0;
model.forEach(function(r,id) {
var eamt = (r\[EtotalKey\]);
//alert(r[EtotalKey]);
//alert(eamt);
var eamtnum = parseFloat(eamt.replace(/\\,/g,'')); //.toFixed(2).trim();
alert(eamtnum);
meta = model.getRecordMetadata(id);
recId = r\[model.getFieldKey("ROWID")\];
isDeleted = model.getRecordMetadata(recId).deleted;
if (typeof(isDeleted) == 'undefined') {
isDeleted = false
};
if (!(isNaN(eamtnum) && !(isDeleted))) {
totamt += eamtnum;
alert('After ' + eamtnum);
}
});
console.log(">> variable totamt is equal to: " + totamt)
// totamt = totamt.toFixed(2);
// const numberWithCommas = (totamt) => {
//return totamt.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
//}
//model.setValue(record,"REVISED_STATE_AMOUNT", cAmt.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,"));
$s('P234\_DTL\_AMOUNT',totamt);
//model.setValue(record,"P234\_AMOUNT", numberWithCommas(totamt));
}

Here is the NaN Javascript alert when a dash is entered as first character

What I would like to see as End Result is for the User to be able to enter Negative Numbers with a Dash ( - ) and Positive Numbers and the Total be Set to the Page Item (P234_DTL_AMOUNT)
Regards
DSteele41