Author Topic: the fomular can not caculate the data of summary row  (Read 2485 times)

徐雪峰

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 48
    • View Profile
the fomular can not caculate the data of summary row
« on: July 30, 2020, 06:04:42 pm »
the fomular can not caculate  the data of summary row?
is there any method?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: the fomular can not caculate the data of summary row
« Reply #1 on: July 30, 2020, 06:09:00 pm »
Which formula are you using. Please share a jsfiddle or stackblitz.

徐雪峰

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 48
    • View Profile
Re: the fomular can not caculate the data of summary row
« Reply #2 on: July 30, 2020, 08:10:38 pm »
i want see the site of http://jsfiddle.net/dhnygcmf/2/,but i cann't see it ,maybe it cannot open in china.

徐雪峰

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 48
    • View Profile
Re: the fomular can not caculate the data of summary row
« Reply #3 on: July 30, 2020, 08:16:21 pm »
my formulas is under.
formulas: [['rchRate04', function (rd) {
            var total;
            if (rd.Cur04Sum != 0) {
                total = rd.Cur04Sum / rd.Cur04Sum;//预算实绩比
            } else {
                total = 0;
            }
            return isNaN(total) ? "" : total;
        }],
        ['CurYearRate04', function (rd) {
            var total;
            if (rd.Last04Sum != 0) {
                total = rd.Cur04Sum / rd.Last04Sum;//前年比
            } else {
                total = 0;
            }
            return isNaN(total) ? "" : total;
            }],
and the under is my colModel:
{
            title: '第三半期(4-6月)', width: 130, align: "center", collapsible: { last: true, on: true },
            colModel:
                [{ title: "预算", align: "center", dataIndx: "YuSum4_6", dataType: "float", format: '$##,###.00', width: 120 },
                { title: "实绩", align: "center", dataIndx: "ShiSum4_6", dataType: "float", format: '$##,###.00', width: 120 },
                {
                    title: "达成率", align: "center", format: '###.00%', width: 120, dataIndx: "rchRate4_6"                   
                },
                { title: "前年", align: "center", dataIndx: "LastShiSum4_6", dataType: "float", format: '$##,###.00', width: 120 },
                { title: "前年比", align: "center", format: '#####.00%', width: 120, dataIndx: "CurYearRate4_6" }
                ]
        }
whatever i try,i cann't see the result of the formula.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: the fomular can not caculate the data of summary row
« Reply #4 on: July 31, 2020, 04:42:16 pm »
dataIndx in the formula definition and colModel should match.

e.g. to write formula for 3rd and 5th column:

Code: [Select]
formulas: [
['rchRate4_6', function (rd) {
.........
}],
['CurYearRate4_6', function (rd) {
.........
}]
]