Calculate a repeatable item [SOLVED]

liquid.ideas

New Member
Hi Guys,
Sorry in advance for this Im sure its obvious but Im just not getting it! Please could you give me the syntax to put into a calc element that does this:

return the sum of {database_name_reapeat} when the parent id is the same?

So add up however many amounts with same parent id?

Sorry for the stupidity here!
 
Have you looked in the wiki or searched the forums for the answer to a similar question?

Because I am sure that your question has been answered before.
 
I have about 400 tabs open perhaps I am reading the answer without realizing it. It must be something quite simple and Im just not catching on. Thanks Sophist Ill keep hunting
 
Right! Well, reading through a million forum posts, I see people who have done the same as me and tried to apply the code (from similar forum posts) to this silly simple issue with no joy. So here Im just going to write what didnt work for me then what did in the hopes that it can help someone else along the way:

Note what it should be returning is 4 (2 and 2)

NOT WORKING
PHP:
$monday=$data['drakensberg_gardens_9_repeat___gr_field1_raw'];
$total = (int)($monday);
return $total;
Returns 1
NOT WORKING
PHP:
$monday = array_sum($_POST['join'][1]['drakensberg_gardens_9_repeat___gr_score_raw']);
$total = (int)($monday);
return $total;
returns 0
NOT WORKING
PHP:
$monday = array_sum($_POST['join'][1]['drakensberg_gardens_9_repeat___gr_score_raw']);
return $monday;
Returns NULL
using this:
PHP:
$post = JRequest::get('post');
echo "<pre>";print_r($post);exit;
I get some information nowhere is the calc element showing on there BUT part of it is showing:
[fabrik_repeat_group] => Array
(
[1] => 1
[5] => 1
[7] => 1
[8] => 1
[9] => 2
[10] => 1
)
That is exactly what I am trying to total. I have no idea why its called fabrik_repeat_group
WORKING:
PHP:
$sum += array_sum($data['drakensberg_gardens_9_repeat___gr_score_raw']);
return $sum;
Returns 4
 
Ah that was with a different bunch selected, was just trying to work out how to call that array with such a general name!
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top