Display top 3 most appearing fields from 8 unique fields?

Hello,

I’m trying to have a page display the top 3 most frequently appearing fields from a list of 8 fields. I have two different types of data that could be used for this including yes/no or numerical with 1s and 0s (1=yes). I’d like it to both show the top 3, and show the percentage of the time that those 3 appear.

I’ve tried so many methods with states, creating new data types, etc. and I just can’t seem to pull this off. Any ideas?

1 Like

You’re overcomplicating it.

Just calculate the total count for each of the 8 fields (using :sum if it’s 1s and 0s, or count where yes = true). Then put those results into a simple list (field name + count), sort that list descending, and display the first 3.

For percentage, divide each field’s count by total entries × 100.

No need for crazy states or complex data types. It’s just aggregation + sorting :+1:

I think you might be overcomplicating things a bit.

@iamcharlesac gave a good explanation, but in the end I still didn’t fully understand what your real scenario is.

From what I could gather from your question, it looks like you have an app with several “questions” (those “8 fields”) and you need to figure out which ones are getting the most positive results. I don’t know if they’re questions and answers, but that’s what I was able to picture here haha.

Instead of having several separate fields, you could have a Response table, where each record represents an answer to a question. Something simple like this:

  • question (identifies which question it is)
  • type (boolean or numeric)
  • value (0/1 or true/false)

Every time someone answers, you create a record in this table. I don’t know why you need to have both boolean and numeric, but I’d suggest keeping just one. Since in the end the result will be positive or negative.

Then, to get the top 3 most used, it’s just:

Do a search for Responses
-Constraint (value = 1 or true)
-Constraint question = Question X
:items until 3

See if that makes sense, or if I just went totally off here haha.

Thanks for the response! Where would I do the calculations? Would it be in the workflow? If so, then how would I get the calculations into the list?

Hi there,

this is a native mobile app which doesn’t have the response table feature unfortunately. Any other ideas?

Please explain your database structure to us in more detail. This will help us to assist you.

I have 8 unique fields (yes/no response or 1-0 response) (Also, only reason I have both is because I’m unsure which will work better for getting this to work. I’ll delete the other as soon as it’s working). And those fields are assigned to a specific google place ID each time a user submits data. So I need to be able to search for that google place ID, find any associated data from users, and find which fields (top 3) that the users select “yes” to most frequently. Then display that data.