Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7810 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

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

Posted

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

Posted

Hi Peter,

The demo mse suggested (Field Ranking & Sort Order, actually 3 demos) achieves what you wish - without script at all!! smile.gif

LaRetta

Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.