Math calculation with NULLs

One of my applications contains 19 columns that I are totaled in a far right column.

My code looks something like:

grid.setColTypes(…,edn,edn,edn,edn,…,edn,edn,edn,ron[=c10+c11+c12…+c27+c28]);

This works fine as long as every column contains a number. Most the columns contain NULL as I don’t want my grid full of zeros.

The nulls in the columns cause my calculation to error and result in NaN.

Is there a work around?

  • I can change my nulls to zeros; is there a way to hide them in the grid?
  • The calculation smarting up and converting nulls in number columns to zeros? :slight_smile:

Please, open ticket at support.dhtmlx.com so we can provide you the latest version of dhtmlxgrid_math.js with included fix.

I have replied with a private message a few days ago; I’m not able to enter a ticket. My private message included my id#.

Also just submitted a 2nd issue with math calcs. viewtopic.php?f=2&t=28793

Thanks!

I received and am using the new dhtmlxgrid_math.js file

The other issue viewtopic.php?f=2&t=28793 is fixed; but this not yet.

Same problem for me …can you suggest some solution on this.

fleetgrid.setColTypes(“tree,ro,int[=sum],int[=sum],int[=sum],int[=sum],ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro[=c10+c11]”);

i am using setColTypes as shown above but int[=sum] gives NaN if i have null value in XML.

Unfortunately the math in grid works with numeric values only.
You will have to convert your NULL in “0” for successful calculation.