This question seems pretty complicated and it leads me to some questions. Why are you keeping lists of things and then ALSO lists of things that are apparently concatenated from somewhere.
Are you confused about the differences between “set list” and “add”/“add list”?
I guess my question is: Do the values for the “CONCAT” lists coming from an external API or something?
The reason I ask is that LISTS in Bubble are, more of less, just like JavaScript arrays. EXCEPT for some differences in the various list operations you can perform.
When you do list operations like “add item” (add a single thing of the list’s type to the list) and “add list” (add an array of items of the list’s type to the list), these ARE NOT equivalent to “push” in JavaScript.
The way those things are different from a “push” operation is that – any of the items that are ALREADY in the list are NOT added.
This seems weird, but it’s actually handy. Lists are generally useful in the same way that arrays are, but the intent of them inside of Bubble is for doing things like, for example, managing user data types such as “Roles”.
By keeping duplicate items from appearing in lists, Bubble removes a lot of the complexity in that. (Consider: If a User takes some action that is supposed to add or delete a Role (maybe now they are not just a normal user but a super-user), I do NOT have to do a bunch of stupid error checking. I can just shove the Role onto their list of Roles. (If they already have the super-user role, they don’t wind up with two entries for that role in their list.) <— hope I’m making sense.
ANYWAY, my point behind this is:
Sometimes it will look like Bubble is not adding something to a list. All THAT means is that the item must already have existed in the list. (It in fact WAS NOT added. However, an identical value of that type is ALREADY in the list.)
If you have list in Bubble that DOES have duplicate items, that list must have been created in a non-standard way (that is, it was not created with the built-in add, remove, etc. list operations).
So you seem to be reporting that sometimes you are seeing lists with multiple null values. Those must be coming from something like some JavaScript you are running on a page, an external API, or something like that.
It is hard (if not impossible) to create a list via Bubble workflow actions that contains duplicate values.
If you DO somehow get an array of values with duplicates in it, the SET LIST operation WILL preserve those duplicates. (SET LIST tells Bubble “here are the list items - do not mess with them - just blow away anything that was here and replace it with this list”.)
However, if you have an existing list and you ADD LIST that has duplicate values in it (or the existing list already has some of the values in it), the duplicate items will be dropped.
Here’s an example. Let’s say I have a thing in my database that is a list of integers. It looks like this:
thing is [1, 2, 3, 4, 5]
Let us now say that I constructed or received some other list of integers that is like this:
otherList is [4, 5, 6, 7, 7, 7]
The result of “thing ADD LIST otherList” is this:
thing is now [1, 2, 3, 4, 5, 6, 7]
If I were to instead do “thing SET LIST otherList” I will get:
thing is now [4, 5, 6, 7, 7, 7]
Perhaps this helps you in your debugging.