Accessing all input collection elements?

Hi,

I am wondering, is it by design, or am I doing something wrong regarding accessing the node’s input.

Say I have a workflow that looks like below:

The Form node gets the input from the Merge node in a form of a collection of objects. Now, I am able to drag any element of the input into “expression” textarea, but only the one from the first object is displayed correctly and actually works:

What is the rule here? Accessing $json.fieldNamegives access only to the first element? Can I somehow access different collection elements by using index or other methods?

And yes, I know I can configure Merge node to combine by all possible combinations and it gives me one object, but I wanted to understand the basics :slight_smile:

  • {{$json.field}} → only the current item (first one in most node params).

  • To access others:

    • {{$item(0).$json.myNewField}} → first item

    • {{$item(1).$json.myNewerField}} → second item

  • To get them all: {{$items("Merge").map(i => i.json)}}

So yes → by design you only see the first, use $item(n) or $items("NodeName") to reach the rest.

2 Likes

This is interesting syntax, and it looks new to me!
Could you please point me to any documentation about it?
I’d like to learn more..

1 Like

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