dimoss
Well-Known Member
Hi
I have the following calc element which shows a text or not if some criteria meet:
The above works fine and if I set the Calc On Save parameter to 'Yes' then puts the WL text on the record. However as it saves the text this cannot be changed when a record deleted.
So I set the Calc On Save parameter to 'No' the text is not saved and the value is calculated on the fly for table rows. However this brings another problem. When the calculation meet the WL criteria then ALL the records on the table have this WL text.
Is it possible this text be shown only on all records after the 'WL' criteria are met?
Thanks!
Dimos
I have the following calc element which shows a text or not if some criteria meet:
PHP:
$a = (int)'{fab_cgs___tournament_raw}';
$b = '{fab_cgs___assoc_raw}';
$query1 = "SELECT count(*) FROM fab_cgs WHERE tournament = $a AND assoc = '$b'";
$db = & JFactory::getDBO();
$db->setQuery( $query1 );
$y = $db->loadResult();
$query2 = "SELECT organizer FROM fab_tournaments WHERE id = $a";
$db = & JFactory::getDBO();
$db->setQuery( $query2 );
$xx = $db->loadResult();
if (($y > 2) && ($xx != $b))
{return 'WL';}
else if (($y < 2) && ($xx != $b))
{return '';}
else if ((($y > 2) && ($y <= 11)) && ($xx == $b))
{return '';}
else if (($y > 11) && ($xx == $b))
{return 'WL';}
else
{return '';}
The above works fine and if I set the Calc On Save parameter to 'Yes' then puts the WL text on the record. However as it saves the text this cannot be changed when a record deleted.
So I set the Calc On Save parameter to 'No' the text is not saved and the value is calculated on the fly for table rows. However this brings another problem. When the calculation meet the WL criteria then ALL the records on the table have this WL text.
Is it possible this text be shown only on all records after the 'WL' criteria are met?
Thanks!
Dimos