On the fly count records with criteria

Status
Not open for further replies.

dimoss

Well-Known Member
Hi

In this thread http://www.fabrikar.com/forums/index.php?threads/on-the-fly-record-count-on-criteria-based.29878 with the help of a forum member I got a calc code in order to to count sorted records on the fly based on criteria and show a sign after a fixed number of records. I use the code on F 2.x with success. See image:

Selection_008.png

However the same code doesn't work on F.3.1.b..:(

The code in the calc element is:
PHP:
$a = (int)'{fab_jbs___tournament_raw}';
$b = '{fab_jbs___assoc_raw}';
$id = (int)'{fab_jbs___id_raw}';
 
$query = "SELECT id FROM fab_jbs WHERE tournament = $a AND assoc = '$b'";
$db = & JFactory::getDBO();
$db->setQuery( $query );
$user = $db->loadResultArray();
 
$query = "SELECT organizer FROM fab_tournaments WHERE id = $a";
$db = & JFactory::getDBO();
$db->setQuery( $query );
$xx = $db->loadResult();
 
$query = "SELECT wl_js FROM fab_tournaments WHERE id = $a";
$db = & JFactory::getDBO();
$db->setQuery( $query );
$wl = $db->loadResult();
 
sort($user, SORT_NUMERIC);
$keyz = array_search($id, $user);
 
if (($keyz > 2) && ($xx != $b) && ($wl != 'Yes'))
{return 'WL';}
else if (($keyz < 2) && ($xx != $b) && ($wl != 'Yes'))
{return '';}
else if (($keyz > 11) && ($xx == $b) && ($wl != 'Yes'))
{return 'WL';}
else
{return '';}

The idea is to sort the records on a list which meets some criteria, and apply the WL sign. However in F3.1.b it return no sign.

Selection_007.png

Any ideas?

Thanks!
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top