Skip to main content
Participating Frequently
April 22, 2012
Question

Auto Numbering List

  • April 22, 2012
  • 1 reply
  • 458 views

I'm working on a prediction game and I would appreciate some advice as to whether it is possible to auto generate the players positional numbers depending on total points scored. At the moment I don't include positions but just order the returned data in ascending order. The problem is when 2 or more players have the same score. I would like to achieve something like below:

PositionPlayerScore
1Player 120
2=Player 215
2=Player 315
4Player 410

I hope that makes sense. Any help would be great.

    This topic has been closed for replies.

    1 reply

    Inspiring
    April 22, 2012

    You can do something like this:

    set currentPositionIndex to be 1

    set actualPositionIndex to be 1

    loop over query, grouping on score

         set currentPositionLabel to be currentPositionIndex

         if the next score is the same as this score then append "=" to currentPositionLabel

         inner query loop

              Output currentPositionLabel, player, score

              increment actualPositionIndex

         /inner query loop

         set currentPositionIndex to be actualPositionIndex

    /loop

    Make sense?

    --

    Adam