Functional operators (map, reduce, filter) and lists operations (zip, unzip, flatten etc.)

I understand that Bubble doesn’t implement cycles (for, while, etc.), but it’s sometimes difficult to implement data operations.
It would be wonderful to be able to:

  • map a list of a type to a list of another type
  • run a workflow for each element of a list
  • flatten a list of lists to a list
  • inflate a list to a list of lists
    and so on, adding functional flavour to Bubble’s expressions.

Hey, I felt that Bubble was quite lacking on these too, until I found about api workflows.

There’s a short and awesome video tutorial on this, and also this video that is specific to lists.

With that knowledge, you’ll be able to do even more than our array.methods() do.

I’m not sure how API Workflows can help me. I’ve watched the videos and I don’t understand in the second video when @romanmg says “this is something that you can’t do in a regular workflow because you’re making individualized changes to an unknown list, we can’t anticipate what the items are gonna be that the user is gonna select nor we can’t anticipate how many they’re gonna be” (https://youtu.be/LLYaNHmt6_Y?t=76)

image

In the button’s workflow I can access the Multidropdown’s list of items and modify their fields almost arbitrarily.

Yes, in your screenshot, that’s a case where you don’t need an API Workflow because you’re using an action that is meant to batch edit and you can inject dynamic expressions that result in different values using “This Thing.”

However, if you wanted to perform a non-batch action on a list of records, then you might be forced to use Schedule API Workflow on List method. For example, sending an email. There’s no action to send an individual email to multiple people - I don’t mean cc/bcc or having a list of addresses in the recipient field; I mean one recipient per email. For this, you’d want to create an API endpoint that sends an email, and then from a page Schedule that API workflow on the list of users, so that for each user, the email is personalized.

Here’s another tutorial with the email example that hopefully clears it up a bit more: https://www.youtube.com/watch?v=gsflyQxAXlk


Gaby at Coaching No Code Apps (formerly Coaching Bubble)

Courses & Products, Tutorials, Private Coaching, and High-level Development

Start Learning Today :mortar_board:

Thanks for the explanation!

Is the launching of API Workflows synchronous or asynchronous? I mean, do the next steps in the parent workflow get executed in parallel or they wait for the sub-workflows to finish?

API Workflows are asynchronous.

1 Like

Learning how to schedule (and optimize) a workflow API on a list will open up a world for you in Bubble - Gaby’s video was a milestone when I was learning. Everyone seems to reach the point where they realize a lot of the workflows are biased to doing one thing at a time.

Recucive workflows are another one to master, Bubble’s somewhat oddball solution for a ‘Do … While’ loop.