solomon2773
New Member
I am trying to sum a total value for a repeat group. I have two groups in a form. First group is a repeat group, and second one is a non-repeat group. Currently the repeat only have one element which is field element and user can repeat it at front end and enter int value. Second group only has one calc element with the code shown below.
When i click on save, i can only read out a value from row 0 from the repeat group. Would you please help on this? Or Can i use this in a multi page form?
Setting up group 3 as second page and only have one element reading the sum value from group2 of page1? Is this possible?
When i click on save, i can only read out a value from row 0 from the repeat group. Would you please help on this? Or Can i use this in a multi page form?
Setting up group 3 as second page and only have one element reading the sum value from group2 of page1? Is this possible?
Code:
$test1 = explode(',', "{ez12_package_forward_order_270_repeat___test1}");
$total = array();
for ($i=0; $i < count($test1); $i++) {
$total[$i] = $test1[$i];
}
$sum = array_sum($total);
return $sum;