Calculations in Grid

I hope if someone can look at this question. I have a solution in sql/php, but it is way to slow.

I made a grid with dhtmlx. the date will be loaded from a php/sql file.(XML-Format)

the sql file contains 3 colums: CONT, DATESTART, NUMBERDAYS.
the data in file is:

  1. 2; 2011-09-01; 3
  2. 2; 2011-09-02; 3
  3. 0; 2011-09-03;0
  4. 2; 2011-09-04;3

For each row i want to know how much containers there are between startdate and the startdate + days.
For the table it will be:

  1. 2
  2. 2 + 2= 4
  3. 2 + 2 + 0 = 4
  4. 2 + 0 + 2 = 4

In sql it is possible, but it is very slow and we want it to change directly if you change one of the values.
1sql row: SELECT * from TEELT
for each row we do:
$startdate=row[DATESTART]
“SELECT SUM(CONTAINERS) from TEELT where ‘$startdate’ between DATESTART and DATE_ADD(DATESTART, interval +NUMBERDAYS-1 day)”

I think it will be possible to do the countings directly in grid and from xml-file but I do not know how.

regards,

Laurens

You can use math calcuations extensions in dhtmlxGrid
docs.dhtmlx.com/doku.php?id=dhtm … _in_grid&s[]=math
This functionality is available in PRO version only