Author Topic: Custom Group Summary  (Read 1958 times)

EPM Solutions

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 182
    • View Profile
Custom Group Summary
« on: December 10, 2018, 09:33:10 am »
Hello Team,

Is it possible to create custom group summaries on columns.

For Example: Check below URL for plunker
https://next.plnkr.co/edit/RSdMNBcsQcYdYwNL

Our Requirement is:
1. Portfolio Group summary row = sum of rows with BudgetClass=Portfolio minus (-) sum of rows with BudgetClass=Budget within a portfolio group


This is needed feature. Please check and give your valuable feedback on same.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6314
    • View Profile
Re: Custom Group Summary
« Reply #1 on: December 10, 2018, 10:26:55 pm »
Since summaries can't access values from other columns directly, hidden columns, formulas and column.render can be used to meet this requirement.

Code: [Select]
     
      {
        title: 'Original Budget',       
        nodrag: true,
        nodrop: true,
        minWidth: 80,
        editable: false,       
        dataType: 'integer',       
        dataIndx: 'orgBudget',
        summary: {
          type: "all"
        },
        render: function(ui){         
          var rd = ui.rowData;           
          if( rd.pq_level == 0){
            return rd.orgBudget2
          }
        }
      },
      {               
        hidden: true,
        dataType: 'integer',       
        dataIndx: 'orgBudget2',               
        summary: {
          type: "all"
        }
      },

Code: [Select]
    formulas:[
      ["orgBudget2", function(rd){
        //debugger;
        if(rd.budgetClass=='Portfolio'){
          return rd.orgBudget;
        }       
        else if(rd.budgetClass=='Budget'){
          return rd.orgBudget * -1;
        }       
      }]
    ],

https://next.plnkr.co/edit/2tR0kOcKxXOofV73
« Last Edit: December 11, 2018, 09:53:11 am by paramquery »