How to get the value id from the first item of a split in batches node?

Does anybody has a good video on how these expressions work??

I searched, i read, i tried but lets be honest- if you are not a programmer, it is hopeless to understand these lists about things you can do. Or at least for me it is.

Anyways, this time, i am trying since 10 hours, to just get the first id value of a split in batches node.

This is not working:
{{ $(‘Split In Batches2’).item[0] }}
{{ $(‘Split In Batches2’).first() }}
{{ $(‘Split In Batches2’).first[0] }}

Does anybody has an idea?

And guys- it would be so helpful to have a good video tutorial on these things, i watched 5 hours of unuseful stuff about very specific use cases on YouTube- nothing got me further with this.

Example Workflow:

Hey @ManyQuestions,
This depends on your usecase actually. So it is always good to give an example which is not working for you to give you better advices.

I created an (strange) example to showcase you how to get the data


  • I want to update the names of my data entries to “Powerful …”
  • Therefore I have a Dataset of
    id: 1,
    name: "Nico"
    id: 2,
    name: "Not Nico"
  • I want to loop over my data set (Split in batches) with a batch size of 1.
  • Afterwards I want to change the name

Note: This is a very strange use case because normally u split the set in batches and then do the modifications and so on within the loop and not afterwards. I just want to showcase you how to access data of the split in batches node.

This is the workflow:

In the Set new Name node u can see that I use this expression to get the data:

Powerful   {{ $('Loop Over Items') }}

This is also the same case if you want to access the data within the loop. As you can see here in the set node within the loop.

Hope that helps to understand a little better.

And good for me: I want to start a yt channel with tutorials on how to become a citizen developer with (open-source) low-code tools. n8n will be my starting point and this topic is now on my list. :slight_smile:



But how to get the ID of the first item?

That makes things more complicated and now you should provide your usecase. It makes no sense to get the id of only the first item in any case I can think of. And also there is no chance to get the data from the split in batch node. but you can grab it from the node before.

Like this:

{{ $('Node before Loop Over Items').first()}}

In the provided workflow by me it is:

{{ $('Create Data').first() }}

There I get the id from the first item from the node before the split in batches node.

Here is the workflow again.

Please provide the usecase and your workflow.


1 Like

Hi @nico-kow @ManyQuestions

There is actually 2 parameters on the first() function.
So you can select the run and outputindex (if I remember correctly)
That way you should be able to do what is needed, not sure why you would in this case but you can. :slight_smile:


Thanks for the answers. I did update the question with an example workflow.

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