Deepak Kumar Posted April 13, 2013 Posted April 13, 2013 Hi All,  How can i calculate rank, based on a single field. I have some duplicate records. Although, i want to rank the student with the highest marks to lowest marks.  Please see attachment for help.  Thanks in advance.
MartieH Posted April 13, 2013 Posted April 13, 2013 I would do a looping find to mark the dupes and use only the first occurence of each record create a global roll number field (G_RollNo), also create a flag field sort the records by Roll Number go to first record Set Field [G_RollNo; Roll Number] Loop go to next record/exit after last if [Roll Number=G_RollNo] Set Field [Flag Field;"X"] else Set Field [G_rollNo;Roll Number] end loop Find Records omitting those with Flag Field marked X and then..... with a couple of extra fields -- G_Marks - global marks field, G_Rank - global rank field, Position, you can do a script like this: #sort records descending by marks Sort Records go to Record/First Set Field [G_Rank; 1] Set Field [Rank; G_Rank] Set Field [Position; 1] Loop go to Record/Next - exit after last Set Field [Position; G_Rank +1] Set Field [G_Rank; Position] End Loop Go to Record/First Loop if [G_Mark = Mark] Paste [select; Rank] else Set Field[Rank; Position] End if Copy [Rank] Set Field [G_Mark; Mark] go to Record Next/exit after last End Loop This will give you marks that will go: 1 2 2 4 4 6 etc.
Recommended Posts
This topic is 4581 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now