Anyone got this bug? (set state > add item to list of numbers = fails to add if numbers are identical

Step:

  1. Add a toggle within a repeating group
  2. When checked, set state of an element to: Existing element’s list of numbers plus item this number.

If I have 2 identical numbers in my repeating group, it won’t add the second identical number to the state.

1 Like

It’s a known behavior. When you use Add, it will only add item if not already in the list. There’s a few workaround in the forum. But they are not easy to find because there’s a lot of question around this :wink:
So here’s the trick:
When you get a list, you first need to use join with (comma for example, but if you have decimal, maybe better to use a delimiter like |). . Because Bubble doesn’t allow to merge dynamic and static text in state actually, you need to use a function that will return true/false and :formmated as text. In Yes and No (set the same in both field) add the static text state + manually a comma, and dynamic value after. Set a first state using this into a single text type element. And after, use split by (with the same delimiter). This will allow the list to have “duplicate” element in it.
Here’s a demo:

So basically, keep in mind that the idea is to convert everything to a single string and after split it.

5 Likes

Lol, thanks Jici, been a while since I’ve had to do this.

1 Like

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