# How to sum inputs for multiple shooters to correctly tally total scores?

Hey everyone!

A friend of mine told me his favorite score-keeping app just stopped support and asked me if I could build something simple without bells and whistles for him to keep score with his buddies when they go shooting (just put in names of shooters, add stations as you go, not much else)

I managed to build most of it already, but I’m not quite sure how I’d sum what’s entered in each of the inputs in the repeating groups that hold the shooters, which are inside repeating groups that hold the stations. Here is what it looks like so far, and how I’d like to display the results:

I’m fairly new to Bubble, but I’d suggest either solving with a state, or an empty invisible repeating group for each person.

You can create the state by pressing the “i” icon in the top right corner of the inspector for any element. If your stations are all on one page you can put the state on the page itself so that all elements can access it. Make a state for each person, and do a workflow that sums each input’s total and then adds to the respective state’s current total.

Invisible repeating groups will essentially do the same thing. Make one group for each person. You just do a workflow to output the total from each input, and then add that in a cell.

Again I’m new to Bubble, but from what I’ve found these solutions offer different results in terms of how you can interact with the resulting data, so maybe play around and see what you think.

Gotta say I’m not about guns, and practicing shooting, but can’t be mad at you for what you wanna do with the tools that Bubble offers.

Thanks for answering in spite of objections to the sport.

How exactly would I use states or a repeating group to accomplish this? What elements would I add the states to? What would I do inside the repeating group to grab these numbers from the other repeating groups, and sum the correct ones?

You’re just going to use conditions and functions in the dynamic inputs to create an equation that calculates the data you want to input, produces the data you want to output, and then that data gets sent to a container–your data set or your empty invisible repeating group. Of course, this all has to be connected to data types and data fields in your database.

I attached screenshots that show an element from one of my pages. I have an app for skateboarders, and users can accumulate points at contests. This element is on a page that displays the results of a contest. This element displays a user’s points total at any specific contest, as well as how many contests they had previously participated in at that time.
Contest is a data type, with a field for the date the contest took place. So, I used the dynamic data to search for all contests newer than the contest displayed on the current page, then count how many entries are on the list, and then subtract that number from the user’s current total number of contests.

These screenshots show how I set up the dynamic data.

This topic was automatically closed after 70 days. New replies are no longer allowed.