Interactive Grid Total Sum,Avg,Count Column Wise / and Grand Total Show runtime in Apex Item

 

Total Sum,Avg,Count Column Wise

Step: 3
=====

Create Interactive Grid and SQL Query Change for Automatic Total value show 0.

SQL Query:

select ID,

       RETURN_BILL,

       PRODUCT_ID,

       QTY,

       ENTRY_BY,

       ENTRY_DATE,

       UPDATE_BY,

       UPDATE_DATE,

       ANIMAL_TYPE,

       AMOUNT,

      'row-show' ROW_SHOW_HIDE

  from PURCHASE_RETURN_DETAILS

 where RETURN_BILL=:P28_RETURN_BILL

 union all

 select 

       -100 ID,

       null RETURN_BILL,

       null PRODUCT_ID,

       null QTY,

       null ENTRY_BY,

       null ENTRY_DATE,

       null UPDATE_BY,

       null UPDATE_DATE,

       null ANIMAL_TYPE,

       null AMOUNT,

       'row-hide' ROW_SHOW_HIDE

  from dual;


Note: You can not hide ROW_SHOW_HIDE column. But you can do Custom Attributes --> readonly

------------------------------------------------------------

Select ROW_SHOW_HIDE Column and 

Go to Column Initialization JavaScript Function

function(options) {
    options.defaultGridColumnOptions = {
        cellCssClassesColumn: "ROW_SHOW_HIDE"
    }
    return options;
}

Step:2
=====

Inline CSS:

tr:has(.row-hide){

    display: none!important;

}

.a-GV-row.is-aggregate.a-GV-aggregate--SUM.is-grandTotal {

    bottom: 0!important;

    position: sticky!important;

    z-index: 101;

}

Step:2
=====
Select Column Which Column (My column AMOUNT)

Column Initialization JavaScript Function:

function(options) {
    options.defaultGridColumnOptions = {
        aggregates: ["SUM"]
    };
    return options;
}



===========Grand Total Show runtime in Apex Item===========




Step:1
=====
Select "Amount" Column in Grid Region.
Create Dynamic Action:
Event: Change

Action: Execute Javascript Code :
Code:

function getdefectqty() {
    let wrongInfo;
    let sumWrongInfo = 0;

    let v_qty;
    let sumv_qty = 0;

    let ig$ = apex.region("tots").widget();
    let grid = ig$.interactiveGrid("getViews", "grid");
    grid.view$.grid("finishEditing");
    let model = grid.model;
    model.forEach(function (r) {
        let meta = model.getRecordMetadata(model.getRecordId(r));
        if (!meta.agg) {
            wrongInfo = model.getValue(r, "AMOUNT");
            sumWrongInfo += wrongInfo * 1;
            v_qty = model.getValue(r, "QTY");
            sumv_qty += v_qty * 1;
        }
    });
    $s("P21_TOTAL_AMOUNT", sumWrongInfo);
    $s("P21_QTY", sumv_qty);
};
getdefectqty();

Step:2
=====
Select Grid Region.
STATIC id: tots

Post a Comment

Previous Post Next Post