wouter.galia
New Member
Hi
I use the calc plug-in to calculate the sum of a repeated group with the code underneath (found in forum).
My setup is very much like the 'venues' and 'bands' tutorial.
Everything works fine except for when I have one item only. With only one item the result is '0'. With more then one item it works fine.
I also would like to put the '?' sign in front.
-----------------------
$fields = array('tablename___listname');
$total = 0;
foreach ($fields as $field)
{
$value = JArrayHelper::getValue($data, $field . '_raw', array());
$thisSum = array_sum($value);
$total += $thisSum;
}
return $total;
-----------------------
Best regards
I use the calc plug-in to calculate the sum of a repeated group with the code underneath (found in forum).
My setup is very much like the 'venues' and 'bands' tutorial.
Everything works fine except for when I have one item only. With only one item the result is '0'. With more then one item it works fine.
I also would like to put the '?' sign in front.
-----------------------
$fields = array('tablename___listname');
$total = 0;
foreach ($fields as $field)
{
$value = JArrayHelper::getValue($data, $field . '_raw', array());
$thisSum = array_sum($value);
$total += $thisSum;
}
return $total;
-----------------------
Best regards