Forum Academy Marketplace Showcase Pricing Features

How to prevent duplication in a repeating group

Beginner’s question…

My app asks users questions, such as, “What’s the world’s biggest mistake?”.

All submitted answers appear in a leaderboard of answers - however, when a user gives an answer that’s already been submitted, I can’t work out how to aggregate that answer with the existing duplicate answer (simply by increasing the existing answer’s “vote” count by one)?

Currently, duplicate answers are being listed in ADDITION to the existing entry - see image.

Thanks

There is a :group by function. Group by the the answers, using the sum of votes as the aggregate.

Thanks very much @alan.mackintosh1

I’ve given it a few goes but everything keeps disappearing :frowning: …will keep at it though!

Do you know if this action should be carried out on the RG itself or individual cells?

Thanks again

on the repeating group. It should be Search for Answers: grouped by (Answer, aggregate by sum of votes)

:unique elements

The value will use do search for:count

:groupby is a better option but both work

1 Like

Plus 1 for this.

Thanks again Alan. I’ve given it another go but not working - can you tell from the inspector where I’ve gone wrong? Cheers

Vote aggregation problem

Thanks @brian1

…what does that mean?

Hmm… this is exactly what I would do.
Are the answers genuinely unique? No extra spaces etc.

Chris.williamson1996 suggestion would also work, search for answers:unique elements.
In the Rep Group, have a text to display the answer, then a text to display Current cell’s Answer’s Vote’s :sum (or count, depending on what works best for your data)

Thanks @alan.mackintosh1

So currently, with the above grouping function implemented, ALL the data from the table disappears so there might be something more fundamentally wrong.

…the two answers I’m trying to aggregate are identical.

Tried suggestion by @chris.williamson1996 but getting error (see image).

Vote aggregation problem 2

Thanks @chris.williamson1996

Unfortunately I’m getting an error…

Vote aggregation problem 2

The :count should be for the text element that will display the count in each rep group cell.
That expression should end after :unique elements.

Thanks @alan.mackintosh1

Data source for RG is Search for Answers:unique elements

But inspector doesn’t give “count” as an option in rep group cell for vote count…

Vote aggregation problem 3

Is your data type a number and not a “text”. I think :sum is probably the more suitable option.

To clarify each cell in your repeating group should have a text with the Answer displayed, then a separate text with the Votes sum.

I would use a grouping on the answer field as a data source. I would use an aggregation of count

Then you could display this cells groupings answer and this cells groupings count

The issue you’ll run into here is if two users answer very similarly but spell their answers differently. The bubble engine won’t account for this.

It means that its the correct approach.

Thanks Alan for continuing to look at this.

The data type is an “answer” so I’ve got as text. As I say, the inspector doesn’t offer “sum” as an option, in either the “rank” or “votes” cells.

Thanks. I think I tried that but it didn’t work :frowning:

Thanks again Jared. I shall manually aggregate synonymous answers in the database.