Page 1 of 1

Calculate and show total of each row and store whole total in a variable

Posted: Thu Jun 25, 2020 1:12 am
by pawansaxena
I have a dynaform with a grid ( salesGrid variable ) in one task ( assigned to one user - employee ) that looks like :
Screenshot 2020-06-25 at 10.39.06 AM.png
Screenshot 2020-06-25 at 10.39.06 AM.png (18.16 KiB) Viewed 380 times
And in next task ( assigned to some other user ) i want to add one more column to the same grid which would show total of each row and also store all of the totals in some other variable to show at some other place.


How can i achieve this without using javascript.

Screenshot 2020-06-25 at 10.39.59 AM.png
Screenshot 2020-06-25 at 10.39.59 AM.png (16.43 KiB) Viewed 380 times

Thanks in advance.

Re: Calculate and show total of each row and store whole total in a variable

Posted: Thu Jun 25, 2020 2:07 am
by pawansaxena
solved it via following trigger :

$lenGrid = count(@=salesGrid);
$sumGrid = 0;

for ($x = 1; $x <= $lenGrid; $x++) {
$tempSum = @%salesGrid[$x]['mon'] + @%salesGrid[$x]['tue']+ @%salesGrid[$x]['wed'] + @%salesGrid[$x]['thu'] + @%salesGrid[$x]['fri'] + @%salesGrid[$x]['sat'] + @%salesGrid[$x]['sun'];
@%salesGrid[$x]['tot'] = $tempSum;
$sumGrid += $tempSum;
}
@%totalAmount = $sumGrid;

Re: Calculate and show total of each row and store whole total in a variable

Posted: Thu Jun 25, 2020 3:23 am
by reshmakavi
Hi admin,
It is Very useful for me...