How to sum calc element in repeating group?

Hello guys, I have already tried total element, but it shows the correct result for only one second and then only 0 (zero). Could you please help me with this issue?

I found also a solution with calc element with code below, but it works only for 2 and more records in repeating group.

PHP:
array_sum($data['table___element_raw'])

Thank you
 
... but it works only for 2 and more records in repeating group
... indicating that it's not an array if there's only a single record. Means you want to first check if it's an array (then use your code), else return the single value only.
 
Code:
if (is_array($foo)) {
    // do something with the array
} else {
    // do something else
}
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top