Author Topic: Trouble in pivot demo  (Read 515 times)

hyh888

  • Pro Enterprise
  • Full Member
  • *
  • Posts: 130
    • View Profile
Trouble in pivot demo
« on: June 16, 2023, 07:10:45 pm »
When I change the pivot demo's foumula to make it do division( line 89-------  var total = rd.gold /rd.silver; ), I found the "sum(total)" column's value change to "infinity".
Is there any solution for it?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6260
    • View Profile
Re: Trouble in pivot demo
« Reply #1 on: June 22, 2023, 02:54:44 pm »
isFinite() check can be used:

Code: [Select]
formulas: [['total', function(rd){
    var total = rd.gold /rd.silver;
    return isNaN(total) || !isFinite(total)? "": total;
}]],                                                     

hyh888

  • Pro Enterprise
  • Full Member
  • *
  • Posts: 130
    • View Profile
Re: Trouble in pivot demo
« Reply #2 on: June 22, 2023, 06:15:05 pm »
Dear Paramvir,
Thank you very much for your reply, but when I tried your solution in your demo, almost all results are wrong(even not "infinit").
In the following pic, in the 1st line, the result should be between 2 and 3, but it becomes 8.

hyh888

  • Pro Enterprise
  • Full Member
  • *
  • Posts: 130
    • View Profile
Re: Trouble in pivot demo
« Reply #3 on: June 28, 2023, 07:49:26 am »
Dear Paramvir,
Should this issue be treated as a bug?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6260
    • View Profile
Re: Trouble in pivot demo
« Reply #4 on: July 06, 2023, 03:07:43 pm »