Average different fields

I’m trying to make a scorecard where there are different categories to score on. For example Creativity, Production Value, Personal Favorite. On the form judges add from a dropdown their different scores between 1-10.

In the workflow I want to take all those different scores and average them. I could not find an easy way to do this, so I created a new field which was a list of numbers. I added each number to this list and then average the list. I thought this would work, but then I noticed if there are two of the same numbers it would only add that number once, and as you can imagine this would break the average.

This solution was a lot of work having to add all the different fields to the list one at a time. Is there not an easier way to just look at the different field values and get an average? Am I missing something?

I think can you just do Each categories’ Score:average?

The problem you are running into is with list add. It bites every Bubble user including myself at some point and costs hours of our lives. The list as you have stated can hold duplicates. but duplicates can’t be added through the “plus item” :man_facepalming: Who knows what that is about.

Anyways the workaround is to basically add a unique identifier with a delimiter and then split out the list by the delimiter when you want to use it (e.g. right before you do your average). This should save you the headache of “adding all the different fields to the list one at a time”.

@ankur1 provided a nice video tutorial of this here: Kindly solve "Adding Duplicate Values in Custom States List". I am Willing to pay - #4 by Raman217

I think you started speaking another language for a moment, haha. Sorry, I’m slow to learn new things. How would I " add a unique identifier with a delimiter and then split out the list by the delimiter"?

@eric10 sorry about that. Click on that forum link and watch the video, it will show you exactly what I clearly did a poor job of explaining in words. I would re-explain it in words but I don’t think I can do a better job then the video did. If you still have questions, let me know, happy to help.

Not your fault, and I missed the link the first time. This might be over my head. I was hoping for a simpler solution, its sad they don’t have something as simple as to average different data fields. I might have to look over the link you sent again to see if I can figure out what it all is. I can’t even figure out how to do the first step of adding the tool. I believe I already downloaded that plugin, but how do I add the tool to the page?

I could easily be missing something here, so just ignore me if you don’t want another person in the mix. That being said, I think Tyler might have been on the right track.

We don’t know what the judges are scoring or how the scores on their scorecards are being saved, but I am imagining a data type where each score a judge submits is being saved as a separate thing with fields for whatever is being scored (which might be a thing from another data type), the category associated with the particular score (with the categories likely coming from an option set), and the score itself. By saving scores that way, you could easily get averages by doing searches with constraints.

Again, maybe I am totally misunderstanding what you are trying to do, but why do you need to add the scores to a list? How are you saving the score-related data in the first place?

So sorry I somehow missed @tylerboodman 's response.

I originally was thinking this was just a simple thing I was missing, so I did not provide much information. Let me add some images to help show what I have setup.

I’m not sure if the “each categories’ score” will work since it is different data fields that hold the information.

I have 5 scoring categories, and each are saved to a Data Type called “Creators_jam_Scores”. We will need to be able to see what each score is, but also what the average of all of them are. I want to average the 5(green box in image), and add that average to the “Score_total” field in the same Data Type.

I have dropdown boxes for each score so getting the individual numbers is easy. Now I just want to get the average to add to the Score_total field, but that is where I’m having issues since I believe I can add those all together, but I can’t average.

I’m looking for a simple command line, but after typing this out I wonder if I can just add all the dropdown values and then divide by 5.

So, yes that actually worked. I was looking for something like average(A, B, C), and completely forgot I could just do simple math. I think I need a break today.

Screen Shot 2022-09-21 at 2.59.50 PM

1 Like

Cool. I had a feeling that creating a list with duplicate scores in it probably wasn’t necessary… glad to hear you got it worked out.

1 Like

Also if you run into order of operations problems, go to your app settings and enable the parenthesis experimental feature (i’ve been using it and no issues at all so far)

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