I’m trying to put a formula in a data source for a repeating group. However, I can’t figure out how to put parenthesis, etc. I would use custom states, but I’m supposed to reference the current cell’s index. Heres what I’m supposed to put in the cell’s text box:
Any idea how to get that done? Thanks.
Did you click the box to allow parentheses in dynamic expressions under general in settings:
wow…no…god, i’ve struggle so much. thanks.
Bubble won’t let you type formulas with parentheses directly into a repeating group’s data source. The editor isn’t a real expression parser, so anything “math-heavy” has to be broken into separate fields.
The way to handle this is to compute the start and end indexes in two separate expressions, then plug them into :items from and :items until. You don’t need custom states for it, and Current cell’s index works fine as long as the RG is the source.
For the “from” value, recreate the formula by chaining simple operations:
((Current cell’s index - 1) * Group ICM’s player_count) + 1
which becomes:
(Current cell’s index − 1) :multiplied by Group ICM’s player_count :plus 1
Then your “until” value is just:
Current cell’s index :multiplied by Group ICM’s player_count
Bubble will parse it correctly as long as each operator is added step-by-step through the dropdowns instead of typing parentheses.
If you want, I can show you the exact click-path so the expression builds without errors.
You sure about that?
Here’s an advanced filter expression inside a repeating group data source using nested parentheses, math operations, and logical OR.
Bubble parses it just fine
2 Likes