Ranking field

MILORD65

Member
I made a database for a riding competition with Fabrik 3.1. A calculated field gives the percentage of points obtained on the maximum possible points. The ranking is for example the following:
1: 71.00%
2nd: 70.65%
3rd: 70.00%
etc.
By a descending sort on the percentage field so I get the ranking.
I would like to more than the calculated percentage field, there is a field (calculated?), Which automatically gives the standings: 1st, 2nd, 3rd, etc.
How can I do?
Thank you for your help.

Jean-Pierre.
 
I did this by first creating a mySQL View to get the needed data. Then just make a read-only Fabrik list on the View.

If the rankings don't update often, you could probably run a Form PHP Plugin or Scheduled Task to update the appropriate field.
 
Thank you for your quick response;
That's what I've done by creating a mysql view for each event (club1, club2, club3):

CREATE VIEW v_Club2 (id, Resultat, Rang)
AS
SELECT t1.id, t1.Resultat,COUNT(*) as rang
FROM t_club2 AS t1
INNER JOIN t_club2 AS t2
ON t2.Resultat >= t1.Resultat
GROUP BY t1.id, t1.Resultat
ORDER BY rang;

However I have wanted to do the same with a php code in an element but I don't have the knowledge for this and I don't know if it's possible.
 
The reason not to try to do this with PHP in an element is that the code is only run when the form is created/edited. You can set a calc element to run on the fly in a list but that is just for display purposes - you can't actually sort or filter the list on that information.

If the View is providing you the desired information, then you can just create a new Fabrik list (read-only) pointed at it.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top