Appending list of items

Hi all

My situation:
I have a questionnaire, where each Answer object (Option) has a list of Recommendations based on whether this Answer is chosen. eg: User selects Answer A => Recommendation X and Y are added to the list of Recommendations.

At the end of the questionnaire, I want to count the amount each type was recommended.
eg: X was recommended 5 times, Y was recommended 3 times

Current solution
After each Answer, the relevant Recommendations are added to a list of Recommendations.

Problem
To create weighting, some Answers have multiple identical Recommendations.
eg: if Answer A is chosen, add Recommendation X, X and Y to the list of Recommendations.

As you probably know, Merge with: does not allow for duplicate objects in a list, so the list doesn’t take the weighting into account.

Possible solution
After each Answer, create a new Score object, or add 1 if the Score is already existing.
The list of Recommendations would then contain a list of Scores, which would then contain a Recommendation and the number of times this Recommendation was recommended.

New problem
Since we don’t know the exact number of Recommendations an answer will have, and Bubble doesn’t have for each loops, there’s no way of creating the right amount of Scores (or adding to the right amount of Scores.)

I hope this makes sense.
Unfortunately, I can’t share the app at this time due to some confidentiality concerns.

Any new ideas would be greatly appreciated.

Kind regards
Peter

Hello @Peter37839 welcome to the community!

Recursive backend flows can be built in Bubble to iterate on each entry of a list

You can also explore a plugin called list shifter which enables browser iteration on a list of entries

1 Like

Thank you cmarchan for your proposed solution.
I was able to resolve it by using the following approach:

  • Create a new Recommendation item after each question. This would then contain all Recommendations X, X and Y for that specific question. This removed the need of using a for loop and ‘Set list’ doesn’t remove duplicates.
  • Work with Filter and Count to get the correct amount of recommendations.
1 Like

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