var widget = apex.region('IG_AGENDAPOINTS').widget();
var grid = widget.interactiveGrid('getViews','grid');
var model = grid.model;
var myJSONString = $v("P303_STANDARD_AGENDA_JSON");
var myObject = JSON.parse(myJSONString);
model.clearData();
for ( var i = 0; i < myObject.length; i++) {
var obj = myObject[i];
//insert new record on a model
var myNewRecordId = model.insertNewRecord();
//get the new record
var myNewRecord = model.getRecord(myNewRecordId);
//update record values
model.setValue(myNewRecord, 'ITEM_NO', obj.ITEM_NO);
model.setValue(myNewRecord, 'UOM_NO', obj.UOM_NO);
model.setValue(myNewRecord, 'REQ_QTY', obj.REQ_QTY);
model.setValue(myNewRecord, 'ISU_QTY', obj.ISU_QTY);
model.setValue(myNewRecord, 'PENDING', obj.PENDING);
};
// So to conclude, these are the steps:
// ORACLE table => JSON => javascript => new records in Interactive Grid
MENU_CODE
, MENU_SEQID
, MENU_NAME
, PARENT_MENU_CODE
, PARENT_MENU_NAME
, PAGE_NO
, SUB_PAGE_NO
, ICON
, STATUS
select '['||(listagg( '{"ITEM_NO":"'||a.ITEM_NO||'",'||
'"UOM_NO":"'||a.UOM||'",'||
'"REQ_QTY":"'||a.REQ_QTY||'",'||
'"PENDING":"'||a.PENDING||'",'||
'"ISU_QTY":"'||a.ISU_QTY||
'"}', ',') within group (order by a.ITEM_NO DESC))||
']' myJson
into :P303_STANDARD_AGENDA_JSON
from ( select saa.ITEM_NO
, saa.UOM
, saa.REQ_QTY
,saa.PENDINGQTY PENDING
,saa.PENDINGQTY ISU_QTY
from V_ISSUE_PENDING saa
where saa.REQ_NO = :P303_P_REQ_NO
and PENDINGQTY>0
) a;
No comments:
Post a Comment