• Clement George
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hi all:

I am trying to build a handicapping system for my clay target club. The requirement is to average the best 8 scores of everyone's last 20. There are 10 different games. 

The custom objects I've built are:

shooter__c - the individual's name + associated data
games__c - a listing of the 10 different games
rounds__c - looks up shooter and games, plus a field for their score. Diff__c is a formula field that subtracts their score from the perfect score.

For each individual, for each game, I would like to average the diff__c on the rounds__c object. I am currently doing this by manually flagging the most recent 20 and the subset of the best 8 and then filtering on those flags = y on my report.

I have two flags on the rounds__c object:
Most_recent_record__c which should be flagged if it is one of the twently most recent records as determined by the date__c field
Lowest_8__c which should be flagged if that score is one of the lowest 8 from the most recent 20. 

I'm not married to Apex updating those flags if there is another way, but I thought a trigger might be the best way about this. 

Thank you in advance!