Newbies Peter Somm Posted July 8, 2003 Newbies Posted July 8, 2003 I want to calculate a ranking for sports events. Everthing works fine and (after sorting) I almost get the correct ranking. The only problem occurs when there are two athletes with the same score. They must get the same ranking. How can this be done with a script. I've got an idea but I can't access the value of a field of another record. The script could look like this. Loop If Score(previous record)=Score(this record) Then Rank(this record):=Rank(previous record) Goto next record End-Loop Can anyone help? Thank, Peter
Lee Smith Posted July 8, 2003 Posted July 8, 2003 When the list is viewed, do the ties take up the numbers below, see example, or are the numbers below sequential [color:"#666666"] .... or 1 [color:"#666666"] ............ 1 2 [color:"#666666"] ............ 2 2 [color:"#666666"] ............ 2 4 [color:"#666666"] ............ 3 5 [color:"#666666"] ............ 4
mse Posted July 8, 2003 Posted July 8, 2003 http://www.nightwing.com.au/FileMaker/demos/AutoRanking.zip
LaRetta Posted July 8, 2003 Posted July 8, 2003 Hi Peter, The demo mse suggested (Field Ranking & Sort Order, actually 3 demos) achieves what you wish - without script at all!! LaRetta
Ugo DI LUCA Posted July 8, 2003 Posted July 8, 2003 Ray's Auto-Rank....or....wait for Russ to come here....
Fitch Posted July 8, 2003 Posted July 8, 2003 Peter, to answer your question about comparing two records: Use global fields to store the first record's value and rank, then in the next record, compare the value to the global, then set the global to the current value, etc. Set Field (Rank, 1) Set Field (gRank, 1) Set Field (gCompare, Score) Loop .. Goto next record (exit after last) .. If (gCompare = Score) .. .. # continue, keep same rank .. Else .. .. Set Field (gRank, gRank + 1) .. End If .. Set Field (Rank, gRank) .. Set Field (gCompare, Score) End Loop Another way this technique is commonly used is to check for duplicate records.
Recommended Posts
This topic is 7810 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