+ Start a Discussion
amrita h 7amrita h 7 

How to rank Users depends on a custom field in apex?

Question in detail : I have 20 Users {U1, U2, U3....}
and 5 Regions {R1, R2, R3, R4, R5}
and Ammount__C custom field on User.
Now those users are distributed among those regions. So i want to give them Rank(Rank__c) depends on the amount they have. for Greater the amount rank will be first. And it should be region wise. Should not consider all users at once. If One region has 6 users, then they should be ranked from 1 to 6. same thing for the next region again. Hope i am clear here.

How to achieve this?