I'm trying to create a golf app for my friends to track our scores over the golf season both Gross and Stableford points (per hole)

The problem I have is that I have created a table with the hole indexes (1 to 18) and on the User Table I have a master score for both Gross and Nett (Stableford) score (1 to 18 twice). So the player enters the score per hole on a History Table (for each Major 10 competitions in the club) I then check using Actions if the score entered is less than the previous score entered for that hole. If it is I update the score on the User table (I check to ensure its not zero first). Also on the user table I need to perform a calculation each time the User enters a new lower score to calculate the Stableford points for that hole, for the users handicap (stored on the User Table also). I’m struggling on how to perform the calculate to create the stableford score per hole for each user. The calcuation is as follows If Hole 1 is Index 6 and the User has a handicap of 6 or more he has a shot on the hole. If the score entered is Par for the hole (4) Then the user gets 2 points Plus an additional 1 point since he has an extra shot. Total Stableford points for the hole is 3.

You could use two JavaScript columns, the first one to calculate the number of strokes received on the hole, and the second one to calculate the stableford score.

To calculate strokes received:

let index = p1;
let handicap = p2;
let strokes = 0;
while (handicap > 0) {
  if (handicap >= index) {
    strokes++;
  }
  handicap -= 18;
}
return strokes;
  • p1 is the Hole Index
  • p2 is the players handicap

And to calculate the stableford score:

let par = p1;
let strokes = Number(p2);
let gross = p3;
let nett = gross - strokes - par;
let points = 
  nett >= 2 ? 0 :
  nett === 1 ? 1 :
  nett === 0 ? 2 :
  nett === -1 ? 3 :
  nett === -2 ? 4 :
  nett === -3 ? 5 :
  nett === -4 ? 6 : '';
return points;
  • p1 is the Hole Par
  • p2 is the strokes received (previous column)
  • p3 is the players gross score for the hole

Here is how that might look in the data editor:

oh, I should point out that the first of the above only works for zero or positive handicaps. If you have any players lower than scratch, then it would need adjusting.

1 Like

I see a thread about Golf, I know for sure you have already responded.

3 Likes

Thanks Darren looking forward to working on this over the w/e.

Works a treat Darren - Thanks a bunch

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.