How to pass a list of parameters to backend where there are duplicactes?

I have a critical problem with my app’s loop.
For months I thought my loop was incorrectly structured (I had some posts about that), but it turns out it is something totally different.

I need to pass a list of texts to the backend so the loop can walk over it but…
I create it the way that the first item is set as the first item from the repeating group and then I am adding items from a search:each items element.

But here is the deadly problem - no option to add list.
As I only have merged or intersect options - the merge is what breaks my app as from passing items like

A - first item
merged with do a search for: (results are B and A)

And it passess to me a list which is A, B.
I need list A, B, A

Somebody recommended me a solution of merge and I was happy until I realized it has this catch.

How can I add a list to an element to preserve duplicates (do not do merge).
So in this case I will receive A, B, A list.
And… the sequence is crucial, so the items cannot be readjusted by doing B, A + A.

Bubble will not accept, with native list function like add, to have duplicate into a list. The workaround is to use a comma (or any other delimiter) list to concatenate item and use split by.

1 Like

That ‘catch’ is not unique to the ‘merge’ operation… it applies basically anytime a list is modified (i.e. you can’t add something to a list if it’s already in the list, and if you remove something from a list ALL instances of that thing will be removed).

But, contrary to what many people might say, Bubble lists can contain duplicate items, and as your list is just a list of texts, the solution is simple (as @Jici has already pointed out).

1 Like

But wait if I do an loop over this list - does it mean that if I have
A, B, A and remove first item i will be left with just B?
Or B, A still?

Yes, it does mean exactly that…

If your list of texts is A,B,A and you run your second iteration on the list minus item: list’s first item (i.e. A), ALL As will be moved form the list, leaving just B.

The workaround here is not to remove the first item, but just define the next list as the first list from Item# 2


Thanks @adamhholmes @Jici. Again you guys come as a salvation to problems :slight_smile:
I have an idea - I will pass the things that have the parameters and later extract their parameters, this way I will pass unique items later on. That is brilliant! Thanks!