Forum Academy Marketplace Showcase Pricing Features

Merging Lists In Bubble

I am trying to merge two text lists (list A and list B) such that I create a third list (list C) that combines the fist two. I see the merge list function in Bubble, but–in creating list C–this function seems to simply append list B to list A.

In creating the new, merged list C, I want to merge the first two lists such that item 1 from list A is followed by Item 1 from list B and then item 2 from list A is followed by item 2 from list B etc. Is this possible to accomplish in Bubble? Also, is there a way to convert a list of integers to a list of texts (integers to strings) in Bubble?

4 Likes

Also looking for this solution. In my use case, we’ve got variations for a store item: Sizes and Colours. The options for reach are stored as text lists (S,M,L and Red,Green,Blue) and I want to create a third list such as “Small Red, Medium Red, Large Red, Small Green…” etc.

Anyone have any ideas?

1 Like

got it!
Imagine you have a list of products and each product has the properties colour and size (like your example)
Each product will have a unique creation date. First get a list of all the creation dates like this:
Search for Product’s Creation Date
then we can use “:formatted as text” to put together any data that shares the same creation date (ie we can put together any data items for that same product in any way we like!).
Search for Product’s Creation Date:formatted as text
then in the “formatted as text” popup type the following:
Content to show per list item:
Search for Product’s :first item’s Colour
Search for Product’s :first item’s Size
delimiter:
,
Each “Search for Product” has the constraint created date = "this date"

The above will yield
product colour A product size A, product colour B product size B, etc
you could compound logic like this to get to @kaden 's solution (use another formatted as text to create another list in the first one)

hope that helps!

1 Like

A little late to this post but I was searching for a solution for a while so maybe it will help anyone still looking for a solution.

The quickest and easiest way I’ve found to accomplish this was to use customs states for each element then combing those into a list state.

For example

Each input element has a state attached
The repeating group displaying both items also has a state attached.

Product A’s state is “chosen product” = text
Product B’s state is “chosen color” = text

Both products’s current product = text
Both products’s state is “products” = list of text

Use a workflow to combine. I chose a button labeled “add product”

Workflow:
Set state product A’s chosen product using product A’s input value
Set state product B’s chosen product using product B’s input value

Set state both products “current product” as “current project:append “chosen color”

Set state “products” as “products”:plus item “current product”.

Reset inputs

Not sure if there’s an easier way out there but this one worked for me. This probably wouldn’t work if you have a large set of inputs but it’s worth a try!