ParamQuery grid support forum

General Category => Help for ParamQuery Grid (free version) => Topic started by: hyh888 on June 16, 2023, 07:10:45 pm

Title: Trouble in pivot demo
Post by: hyh888 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?
Title: Re: Trouble in pivot demo
Post by: paramvir 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;
}]],                                                     
Title: Re: Trouble in pivot demo
Post by: hyh888 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.
Title: Re: Trouble in pivot demo
Post by: hyh888 on June 28, 2023, 07:49:26 am
Dear Paramvir,
Should this issue be treated as a bug?
Title: Re: Trouble in pivot demo
Post by: paramvir on July 06, 2023, 03:07:43 pm
This is answered here: https://paramquery.com/forum/index.php?topic=4648.0