Backend Workflow Simple Calculation

I believe I need to use a backend workflow for what i’m trying to accomplish. Here’s a brief summary of what i’m trying to ultimately accomplish with my app. Keep in mind, this app is being built to run a sports league.

I would like my data to have list of users and each user has:

• field 1 (scores) = running list of their scores
• field 2 (average) = average of the last 10 scores
• field 3 (handicap) = a range of numbers (if the average is greater than X or less than Y this number goes up or down.

When a new score is added to any users list of scores, a new average of the last scores need to be calculated for any and all of those players. I’m thinking I need a backend workflow that calculates the average of running scores if a change occurs. It may be simpler to just create a recurring event that calculates all players average daily but less efficient? ( i have no idea how to do either of those, but im ready and willing to learn) . Once this average is updated, then i would need another backened work flow to change the handicap if the average it too high or low?

So far, all I have is a running list of scores for each user and I created the field (average). My first hurdle is, calculating the average of the last 10 scores of a running list. Since the list is dynamic, i would like the average to change when a new score is entered. This sounds like a backend workflow…

Thanks for any and all help!!!

1 Like

Without diving too deep into this, it sounds like you can accomplish with the “do when a condition is true”

and set it to run every time and then you set the “only when” field to be the rules of what you’ve described above

Since the average score is calculated and stored on the DB, you will have to set up a workflow that triggers when a new score is added.

You can do this by creating an event-driven workflow, similar to what @paul29 pointed out. It really depends on how the score is entered.
If it’s manual, you can define a workflow that triggers ‘when input value is changed’. Or add it to the workflow that runs when the user enters the new score an presses ‘submit’ - if that’s how it works on your app.

The action for updating this can be ‘make changes to a list of things’, where you select all the relevant users where the averages need to be updated.
Here, you put in the new average value by referencing the current user being updated:
Average = This User’s scores: items until #10 : average

you can similarly update the other fields here