Ranking within a gruop.

Fuga

Registered User.
Local time
Today, 12:38
Joined
Feb 28, 2002
Messages
566
Hi,

I would like to rank participants in a race from 1 - 6.

The data looks like this:

race(integer)/ startnumber(integer)/ odds(integer)

1 / 1 / 44
1 / 2 / 13
1 / 3 / 25

When sorted descending on the odds field, I would like to add ranking, so that number 1 will be ranked 1st, number 3 2nd and number 2 3rd.

How would you do this?


Thanks.


Fuga.
 
Last edited:
Use a query, with a descending sort on Odds
 
Thanks for the reply!

I asked a really stupid question. Sorry.

What I meant was that the data looks like this:

1/1/44
1/2/13
1/3/25
2/1/22
2/2/55
2/3/11

etc

So, what I want is (extra column for ranking)

1/1/44/1
1/2/13/3
1/3/25/2
2/1/22/2
2/2/55/1
2/3/11/3

Actually there are 6 participants in each race, but I only use three here.

Thanks

Fuga.
 
Add a column to the query, i.e. Rank, which is a call to an incrementng function, i.e.:

Rank:IncCnt(True)

Put the following in a module:

Global iCnt as integer

Add to the form which triggers the query or to a module:

Public function IncCnt(fInitialize as boolean) as Integer
if fInitialize = true then
iCnt=0
IncCnt=0
else
iCnt=iCnt+1
IncCnt=iCnt
end if
end function


Initialize prior to running your query with a call where fInitialize=False (to reset the counter).
Use in your query with fInitialize=True
 

Users who are viewing this thread

Back
Top Bottom