[New Feature] '...:format as text' operator on lists

Hello everyone!

Formally announcing the release of this feature. Some of you have already noticed and used it but we were a bit quiet about it as we wrapped up some QA tasks.

This operator can be applied to a list of things to display its content in a custom format. You can choose a delimiter for your list, and the content to show per list item. All items will share the format that you specify. For example, if you have a list of names, you can choose to display “This name” in bold with a space delimiter. This will show all the names in bold separated by a space: name1 name2 name3.

This is also useful for sending emails to your users. In the body of your email, you might format a list of Events to display start times for upcoming events. You can also add bb code to customize its appearance. For example, if you specify your content to show as “[li][b]This date[/b][/li]” and your delimiter as a line break, you can create a bolded list with bullets:

  • January 1, 2021 1:00 pm
  • January 1, 2021 1:00 pm

If you need to format text as a JSON to send to an external API, you may also use this operator. You can create
{
key: “value”
}
formatting for as many of the values as there are in your database. For example, you might pass a list as:
{
key: “This value’s field”
}
Then if your list contained two items, the result could look like:
{
key: “Value1’s field”
},
{
key: “Value2’s field”
}

Also note that you can use this operator in a nested fashion. As an example imagine you apply to to a list of users, with newline delimiter and content “This user’s name is friends with This user’s friends”, you can then apply ‘:format as text’ to ‘This user’s friends’ to choose how to display that list.

These are just some examples of how the feature can be used. What are some cool examples of how you’re going to use this feature? Please feel free to share here!

33 Likes

Can’t repeat a good thing often enough: this is awesome :partying_face:

1 Like

Super useful indeed! (Now can we get a :split into listoperator for strings, whereby a string is split into a list of texts based on a user-specified delimiter?) :pray: :grin:

EDIT

And yes, I realize regex can be used for this; but I didn’t choose Bubble to spend my time constructing geeky regular expressions. After all, they’re hardly “no code”. :confounded:

13 Likes

This for me was one of the most useful feature launches of 2020. From a “day to day” workflow perspective, this was a big winner - I use this feature almost daily now.

Cheers to more of these!

2 Likes

Same ! So so useful.

1 Like

This is an excellent addition to Bubble. Great work, a nice surprise, and praise for the developers! And very elegant, Bubbly design, not a departure from what is familiar!

The JSON nested array problem was solvable with plugins, but having this as part of the foundation eliminates the worry that the winds of time will leave you with something unsupported. This is the big win from my perspective, since I can confidently develop against external services where there is a potential 1-to-many in the body of the API.

Seriously, nice work.

Now … can we have a proper GET that returns a list in the backend workflows? You can reserve the right to throttle on the lower plans …

1 Like

This is an awesome feature I stumbled across this post by chance this evening after earlier in the day wishing for this exact feature!! This has had a major impact on my app functionality.
It even delighted me further by supported a nested “…format as text” so I could combine the data from a list field as well.
Nice work!!

this is great @gerry98, but I am trying to use it to format an input to be consumed as JSON for another API call, but it’s not working, can you spot the error?

1 Like

Hey @natserrano ! I can’t spot the error here. If you are still experiencing this issue I would suggest that you either create a separate post to give it more visibility or create a bug report here Bug Report | Bubble

Thanks for the response. It was a human mistake (me) trying to import as text…it’s solved now. Thanks

1 Like

Hi @gerry98,

I am facing some issue when try to use this feature to send JSON array to an API call, but somehow failed, it did not detect the string that I have send using dynamic values with formatted as text. BUT when I typed it directly and send to the API, response is success.

Failed response setup (using dynamic values)

Screenshot 2021-02-09 at 4.43.01 PM

Success response setup

1 Like

Hi @gerry98
Is it possible to create an xml code like this, from multiple “list of text’s”?:

 <people>

    <person>
    <firstname>Pete</firstname>
    <lastname>Johnson</lastname>
    </person>
    
    <person>
    <firstname>Scott</firstname>
    <lastname>Smith</lastname>
    </person>
    
    <person>
    <firstname>Neil</firstname>
    <lastname>Williams</lastname>
    </person>

  </people>

Can’t figure it out how to do this.

1 Like

I have the same problem. Did you find a solution?

1 Like

Hi. I did.

I removed all spaces in the array. It works like a charm. Give it a try.

2 Likes

Thanks a lot! This has solved my problem!

1 Like

does anyone know how to add a line break to the delimiter? Im trying to format a text to be used in a POST bulk call.

Screen Shot 2021-03-06 at 12.25.33 am

The body of this request should be a text document with one new object to create per line. The objects should be in JSON format, without any newlines; the keys and values should be the same as when creating a single thing

1 Like

I think that if you hit the enter button in the keyboard when in the “Delimiter” field should work.

2 Likes

@ryanck Yep that did the trick!

Super excited about this. Just used it to send an email for “unread” messages!

Does anyone know how you can access higher-level iterators compared to the most recent one? I.e., if I’m doing a “roll call” of Product names inside Product categories, is there any way I can access “This Category” and not just “This Product” when I’m going nested?