Calc element - value from database join

ignacyw

New Member
Hello,
i'm trying to use calc element to sum filtered data from the table.

I created a form where i use some elements to determine the filters and the calculation itself
- start_date [jdate]
- end_date [jdate]
- category [field]
- type [databasejoin]
- sum [calc]

[jdate] and [field] elements are working fine.
But when I add [databasejoin] seems that [calc] takes the label from the [databesejoin] instead of value - and so the result of [calc] is empty.

Here is the example of my [calc] field:

Code:
$db =& JFactory::getDBO();
$db->setQuery("SELECT SUM(`price_net`)
FROM (`price_table`) WHERE ((`date`)
BETWEEN '{report___start_date}' AND '{report___end_date}')
AND
((`category`)=1)
AND
((`type`)='{report_type}')
");
return number_format((float)$db->loadResult(), 2, ',', '');
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top