Convert list to comma separated string

I currently have a list of addresses in my database formatted in a column and I would like to convert it into a comma-separated string so that I can call upon it for my Map app formatted like the following (without brackets):

[address 1],[address 2],[address 3]

This is what I currently have however it only pulls the first address from the list.

image

2 Likes

use :join with and add a comma

3 Likes

Being explicit, as @Jici recommends, is probably the best approach, as it allows you to choose the delimiter.

However, it’s worth knowing that Bubble will automatically convert a list into a comma-delimited string when that list is used in a string context (IF the data type comprising the list can be represented as a string).

So for instance, setting a text element to a list of images will result in a comma-delimited series of URLs. In your case, simply using the list of addresses in a string context will achieve your desired result.

SIDE NOTE: If any of the addresses contain commas - e.g. 123 45th Street, Unit B - that could result in unwanted side effects down the line, so beware. You might want or need to use something other than a comma as the delimiter.

1 Like

Thank you, I’ve got to go over the documentation but this worked perfectly.

How do you convert a list to a string?

Since the :format as text operator was introduced, it’s probably the best, most versatile way to go about it.