Nested function_items

Hi guys, thank you for this amazing comunity!

I’d like to understand the behavior of function item node:

  1. if an input of 5 items enter in a function_item, all the following nodes will be executed 5 times, one for each outputed item?

  2. if I have two function items in a given flow, how can I access the output of the current execution of the first function item node inside the second function node?

Thanks!

Welcome to the community @reichert

  1. if an input of 5 items enter in a function_item, all the following nodes will be executed 5 times, one for each outputed item?

That is correct. Unlike the function node that is executed just one time no matter the input.

  1. if I have two function items in a given flow, how can I access the output of the current execution of the first function item node inside the second function node?

You can access the output of the nodes with the variable $items. Check the link below

Hi Rodrigo, thanks for your answer,

  1. Actually I did a test and I noticed that the function_item (in the first example) run 5 times while the next node after the function_item just run once. I tested it with console.log. Is that correct?

  2. If that is correct, this question does not make sense and the correct approach would be to use splitInBatches instead.

  1. Actually I did a test and I noticed that the function_item (in the first example) run 5 times while the next node after the function_item just run once. I tested it with console.log. Is that correct?

What node are you using after the function item node?

See here for more information on how the Function Item node works:

A node function, just to console.log something and check what happens.

Thank you @ivov
I already read this more than once in order to understand well.

Hi @RicardoE105 do you suspect of something wrong with my results?

  1. Actually I did a test and I noticed that the function_item (in the first example) run 5 times while the next node after the function_item just run once. I tested it with console.log. Is that correct?

You are using two different types of nodes.

The function item node and the function node. The function item node will execute as many inputs as it has. The function node will execute just once, no matter the input. So, the test that you did is correct. The confusing is that you said function item twice when in reality, you used one function item node and one function node.