July 8, 200322 yr Newbies 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
July 8, 200322 yr 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
July 8, 200322 yr Hi Peter, The demo mse suggested (Field Ranking & Sort Order, actually 3 demos) achieves what you wish - without script at all!! LaRetta
July 8, 200322 yr 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.
Create an account or sign in to comment