Need help rethinking my data types for duplicates in a list

Hey everyone,

So I was running into a problem with storing duplicate values in a list, and a core function of my app is just being able to store duplicate values in a list and average them.

It’s an app to rate people’s attractiveness so you have values 1-10 to pick from. And each user has a list of how women rated them and how men rated them. Both of those averages are then shown to everyone.

If a list won’t work, I thought I might need to create individual data types called 1, 2, 3, 4… etc that contain a list of users. But that still lumps female and male ratings altogether. So having 20 individual datatypes for female1, female2, male1, male2, etc… just seems like there has to be a better way. And I’m not even sure how you’d take the average of all the male lists or female lists once you have them lol.

I’d really appreciate any help :slight_smile:

Hi there, @trumpchaos… it sounds like you probably need a Rating data type. When a user rates someone, create a new thing in the Rating data type, and have fields that store the user who is being rated and the rating. You won’t need a field for the user who is doing the rating because the built-in Created by field will do the trick there. If knowing the gender of the user who is doing the rating is important, you might want to have a field directly on the Rating data type to store that piece of information so that you don’t have to use an advanced filter to get it if you need it.

With the data type I described above in place, you should definitely be able to get the averages you want.

Hope this helps.

Best…
Mike

1 Like

Okay, I think that makes sense. And I’d also need to have a list of Rating attached to the original User datatype, right?

So this would all look like:

User

  • ratings (list of Rating)

Rating

  • person being rated (User)
  • rating (number)
  • gender of rater (text)
  • Created by (User)

Then when I go to sort the average, I can filter exclusively for ratings that come from male or female for a specific user. Then use the :sum function of each rating’s Rating attributed to a user divided by the :count of the number of ratings.

You don’t necessarily have to have a list of ratings on the User data type because you can get what you need by using constraints on searches of the Rating data type. That being said, it probably wouldn’t hurt to have the list, too, unless you are expecting a user to have hundreds or even thousands of ratings.

1 Like

Okay yeah I’m anticipating having at least hundreds of ratings. Now that I think of it, I remember reading here that a list is really only suited for small number of entries anyway.

Thanks for the help Mike!

1 Like

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