AnsweredAssumed Answered

stored Ranking

Question asked by malijames on Jun 21, 2013
Latest reply on Jun 21, 2013 by malijames


stored Ranking


I have student table with the following fields Name , class,point1,point2,point.....  and  with a calculated  field called Total which is the sum of each student points then  another field called Rank wich calculate the rank of the total field now  how do I get my Rank field to store or replace the field content with  the actual  rank calculation used so that when sort by student name , the ranks will follow their respective total. At the moment I have to sort by Total field in descending order to get and accurate rank but when sorted back by names, the rank field don't get sorted because it is set not to store calculated result. * Can the rank calculation be limited to a found set? *  Can't I rank without sorting the Total? * If Sorting is necessary how do I write a script that  sort the found set by totals,rank them, store the ranks and sort again by names ( the found set)? * how do I achieve all these if the student table is used in a portal (that is ranking only found set in that portal) *the portal is used in a layout called "session" from session table linked to student table by fk_session_ID The rank formula used is If ( Get (RecordNumber ) = 1 ; 1 ; let ( [PrevRec = Get ( RecordNumber ) - 1 ; PrevTotal = GetNthRecord ( Total ; PrevRec ) ; PrevRank = GetNthRecord ( Rank ; PrevRec ) ] ; If ( PrevTotal = Total ; PrevRank ; Get ( RecordNumber ) ) ) ) Can this formula be converted to a script? Help me out please