n8n-docs/docs/nodes/nodes-library/core-nodes/SplitInBatches
Harshil Agrawal 7b460243ab
SEO Update (#206)
2020-10-09 14:18:10 +02:00
..
Function_node.png 🐛 Bug fixes 2020-09-21 13:24:30 +02:00
README.md SEO Update (#206) 2020-10-09 14:18:10 +02:00
RSSFeedRead_node.png 🐛 Bug fixes 2020-09-21 13:24:30 +02:00
SplitInBatches_node.png 🐛 Bug fixes 2020-09-21 13:24:30 +02:00
workflow.png 🐛 Bug fixes 2020-09-21 13:24:30 +02:00

permalink description
/nodes/n8n-nodes-base.splitInBatches Learn how to use the Split In Batches node in n8n

Split In Batches

The Split In Batches node saves the original incoming data, and with each iteration, it returns a predefined amount of data. This node can be used to loop through the data.

Node Reference

  • Batch Size: The number of items to return with each call.
  • Options
    • Reset: If set to true, the node will reset.

Example Usage

This workflow allows you to read RSS feed from two different sources using the Split In Batches node. The Split in Batches node is needed in the workflow since the RSS Read node only processes the first item it receives. You can also find the workflow on n8n.io. This example usage workflow would use the following nodes.

The final workflow should look like the following image.

A workflow with the Split In Batches node

1. Start node

The start node exists by default when you create a new workflow.

::: v-pre

2. Function node

  1. Paste the following JavaScript code snippet in the Function field.
return [
  {
    json: {
      url: 'https://medium.com/feed/n8n-io',
    }
  },
  {
    json: {
      url: 'https://dev.to/feed/n8n',
    }
  }
];
  1. Click on Execute Node to run the node. :::

Using the Function node to return URLs

::: v-pre

3. SplitInBatches node

  1. Set the batch size to 1 in the Batch Size field.
  2. Click on Execute Node to run the node. :::

Using the Split In Batches node to split the data

::: v-pre

4. RSS Read node

  1. Click on the gears icon next to the URL field and click on Add Expression.
  2. Select the following in the Variable Selector section: Nodes > SplitInBatches > Output Data > JSON > url. You can also add the following expression: {{$node["SplitInBatches"].json["url"]}}.
  3. Click on Execute Node to run the workflow. :::

Using the RSS Read node to read data from RSS feed