Repeating group with many unique conditions

Hello! I have a challenging task that I can’t seem to make progress on.

I have a repeating group connect to a data type with ~6 items in it. The repeating group has 2 cells - as I would only like to show two out of the 6 things at any one time. The things are ordered in the database (1-6).

The tricky part is, each item has a unique condition (math based) that I would like to use to dictate whether or not it is hidden.

For example, if condition on item #1 is met, that field will be hidden, and 2 & 3 will show. If the second is met, but 1 and 3 aren’t, then 1 & 3 will appear in the list. If 1, 2, 3’s conditions are all met, then 4 & 5 would show up, and so on.

I’ve read in other posts that bubble conditions can determine what is shown/hidden in a repeating group, but I’m not quite sure how to apply different conditions to different items in the list.

Does anyone have an idea as to how I can approach this?

Thank you!

I don’t know if it helps, but…

Conditions aren’t applied to items. They’re applied to the list as a whole. If an item in the list matches the condition, it will appear in the list. You can certainly have multiple conditions though.

Thanks, shot! Is there a way to apply a condition-like rule (maybe a state?) to individual items in a list?

You can use boolean logic and reference states in the dynamic expression builder to determine what (if anything) appears in a given cell of a RG, but to prevent certain items (cells) from appearing in the list altogether, the list will need to be filtered.

I’m a little bit confused by this wording though…

I interpreted it as, “if item #1 meets the condition”. Anyway, if you can provide a more concrete example, it might be helpful.

Thanks again! To give some examples, the list could be:

  1. Run a mile below 8 minutes (Condition: This item is visible if best mile time is greater than 8 minutes)
  2. Run a half marathon (Condition: This item is visible if longest run <13 miles)
  3. Complete a triathlon (Condition: Visible if # of triathlons =0 )

As you can see, the items in the list don’t relate to one another, so I’ll need to check if each meets it’s unique condition in order to determine if it’s visible or not. (Your interpretation of my poor wording was correct).

One idea is to abandon repeating groups all together - and put each item in its own collapsable group. The only tricky part with this is limiting it to only two visible groups at a time.

Do you think this would be the best bet?

Am I correct that the data required to evaluate each condition - i.e. best mile time, longest run, # of triathlons, etc. - already exists as fields of the User object?

Yes! All data already exists in the database, however, they’re not all fields in the User object. They are in a different object that has the User object as a field.

Ok, thanks, I think I understand now.

I would tend to think of this in terms of “computed fields”. In this case, there’s some boolean data you’d like to associate with the object and which is calculated based on other fields of the object. Unfortunately, in Bubble doesn’t have a special “formula field”.

So, the issue comes down to where to put the various formulae and how to integrate them into a search. I can think of at least a couple ways to go about it, assuming there’s a “master list” of “recommended activities”.

One approach uses formulae in the search filter, and the other uses formulae in conditionals of an element. The latter approach is simpler (fewer steps and avoids the need to initialize the activity list with a workflow), but it shows all activities and simply flags the recommended ones.

With either approach, every time a new “activity recommendation” is added, a corresponding formula must be implemented - i.e. either a new search filter or a new conditional must be added.

Anyway, let me know if this comes close to what you’re after…

1 Like

Sorry for my delay! Thanks for digging into this - your answer makes sense.

I’m going to give implementation a stab tomorrow and will let you know how things turn out. Appreciate your help.

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