### Title

Rank with ordinal suffix

### Post

please how do I rank a calculated field called "Total". The total is based on the sum of different subjects. I want to create a new field called "Rank" to display the ranks of each student 1. I want the rank to be updated as the totals change (if possible) 2. The rank be updated without sorting the layout (table view) if possible 3. The ranking should appear with ordinal suffix like " st,nd,rd, th I.e 1st,2nd..........) 4. If I'm on a form view or portal , can the rank be updating as I change scores ? 5. The rank should take note of ties 6. My portal is based on the subject table Hope I'm not asking too much I have 2 tables STUDENT and SUBJECT table related by pk_STid and fk_STid. Please help me out Thanks in advance

If you have all these records in a single found set, sorted in descending order by Total, then this unstored calculation named "Rank" can report the rank:

Case ( get ( RecordNumber ) = 1 ; 1 ;

Total = GetNthRecord ( Total ; Get ( RecordNumber ) - 1 ) ) ; GetNthRecord ( Rank ; Get ( RecordNumber ) - 1 ) ) ;

Get ( RecordNumber )

) //

You have to get sneaky to define this field.

Add a new number or text field named Rank and click Create. That adds "Rank" to the field list so that the calculation can refer to itself.

Then change the field type to Calculation and add in the above expression. Be sure to click storage options and specify the "do not store..." option.

This produces the rank number but not the ordinal suffix. Get the above calculation working for you first, then add this calculation field to properly format the Rank:

cFormattedRank: Rank & If ( rank < 4 : Choose ( Rank ; "" ; "st" ; "nd" ; "rd" ) ; "th" )