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

Questions and discussion about using ProcessMaker: user interface, running cases & functionality

Moderator: ArturoRobles

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

By pawansaxena
#828162
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 (18.16 KiB) Viewed 1933 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 (16.43 KiB) Viewed 1933 times

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

By pawansaxena
#828163
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#828165

By reshmakavi
#828165
It is Very useful for me...

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

By shreekavi
#828395
There are many ways to write a C program to calculate the sum of two numbers i.e. using 3rd variable, using function, using pointers, etc.

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

By pawansaxena
#828396
reshmakavi wrote: Thu Jun 25, 2020 3:23 am Hi admin,
It is Very useful for me...

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

By pawansaxena
#828397
shreekavi wrote: Mon Sep 07, 2020 6:32 am There are many ways to write a C program to calculate the sum of two numbers i.e. using 3rd variable, using function, using pointers, etc.
No offense but i suggest you come here after your hangover ends

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

By aaravkl
#828398
I feel to happy to visit this. Helpful one.
###### DELETE A OUTPUT DOCUMENT

I solve the problem using this trigger \$caseId =[…]

###### Task multi assigned users. Single submit

First off I am new to processmaker. I am trying to[…]

###### Total of grid in integer

Hi, Is there any better way to do it instead of c[…]

###### PROCESS MAKER 3.5 TRIGGER NOT WORKING IN ANDROID APPLICATION

Hi All, I am using 3.5 version and everything work[…]