Run Action for every item in the list

Please add a formula to run Actions for every item in the list.
This will really help speeding up workload if used in the right situation.

Right now there’s only option to either run a formula for every item in the list using ForEach() or FormulaMap(), or,
using Runactions() to run multiple Actions where each Action needs to be defined manually.

Turns out, trying to combine the two protocols won’t work.
For example: [list].ForEach([action formula]) doesn’t seem to work.

actually there are 2 formulas that will do exactly what you want…

myList.ForEach( … )

and

myList.FormulaMap( … )

they are both the same function, but the ForEach name was added recently for greater clarity.

respect
max

Hi unfortunately I tried them, but can’t make it work with actions.

So if you insert Action into the formula, it seemed to just ran once.

For example: myList.ForEach( Addrow )

Can you help confirm this? I wonder if I did something wrong to make it doesn’t work.

Hello @Sathya_Thunger ,

That definitely works, I use it every day. So there is something wrong with your code.

Make a dummy doc with a sample of what you are trying to accomplish, share it with the community and we will show in your doc how it is properly formulated and that it really works.

Hi here you go :slight_smile:

@Sathya_Thunger ,

Scenario 1 is a bit of a nightmare, but it works with some extra effort. A bulleted list is not ideal for doing this type of operation.
Scenario 2 I skipped.
Scenario 3 is a lot easier.

The resulting value in the target table column 1 can obviously be anything you like I assumed you wanted one of the list items, but if you want all three, you can leave out nth(currentvalue).

You don’t have to use sequence, you can use the list (scenario 4) instead, maybe that is what you really want?

1 Like

Thanks! Yes Scenario 4 works. I don’t understand about Parsing JSON function yet…

So combining ForEach() and Actions does work.
The confusion was just about what ‘list’ refers to.
Apparently bulleted list (as in standard text) not considered a ‘list’ by formula. And instead, what formula means by ‘list’ actually refer to an array (formula generated list).

Apparently I can now make it work with bulleted list by first turn it back into non-bulleted text list, and then split it by linebreak to create an array, then use CurrentValue for each sequence of action:

[bulleted_list].ToText().Split(LineBreak()).ForEach()

With this, everything solved. Again, many thanks for your time and effort :slight_smile:

Once you know…you know.
The concept of how to use lists has to become 2nd nature.
About your solution: we try to avoid ToText(), but if it works, it works. Often, with solutions like that, you eventually run into a problems. Imagine your bulleted lists consist of 3 items, each consisting of multiple lines. I am not going to try, but generally speaking, “tricking” the program to do what you want it to do is not always best practice.
Your bulleted list has been put together from single items (I imagine), so use that source as input rather than the output of that source.
You can use the formula also like this:
table.filter(user filter).column_with_items.foreach(...)

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.