Hello,
I really don't know what i'm doing wrong here. I want to use a calc element to retrieve the max value of an element and return the value. So i wrote a simple query:
The query is returning the correct result when i run it directly in database:
SELECT MAX(`grupeaza_optiune`) FROM `contracte_setari_6_repeat` WHERE `parent_id` = 26
return: 5
But using the calc element is showing 1 instead of 5..and i don't know why
For testing, the calc element is set to "calc on load" but i will need to use "Ajax Calculation". Please note that the calc element is in a repeat group.
Thank you
I really don't know what i'm doing wrong here. I want to use a calc element to retrieve the max value of an element and return the value. So i wrote a simple query:
PHP:
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query
->select('MAX('.$db->quoteName('grupeaza_optiune').')')
->from($db->quoteName('contracte_setari_6_repeat'))
->where($db->quoteName('parent_id')." = 26");
$db->setQuery($query);
$result = $db->loadResult();
return $result;
The query is returning the correct result when i run it directly in database:
SELECT MAX(`grupeaza_optiune`) FROM `contracte_setari_6_repeat` WHERE `parent_id` = 26
return: 5
But using the calc element is showing 1 instead of 5..and i don't know why
For testing, the calc element is set to "calc on load" but i will need to use "Ajax Calculation". Please note that the calc element is in a repeat group.
Thank you