Use cases for the Merge, Split Out, Aggregate, and Summarize nodes

Describe the problem/error/question

I’m new to n8n and trying to understand the proper use cases for a few key data manipulation nodes, specifically Merge, Split Out, Aggregate, and Summarize.

I’m working on a workflow that pulls user data from two different sources. The first source returns a JSON array of user profiles, and the second source returns a corresponding JSON array with detailed contact information for those users.

My goal is to:

  1. Combine the user profile and contact information based on a common userId.
  2. Count the number of users from each city.
  3. Split the combined, enriched user data back into individual items so I can process them one by one (e.g., send an individual email to each user).
  4. (Optional) Calculate summary statistics for a numeric field for each user, like totalSpent.

I’ve tried different combinations of these nodes but I’m unsure which node is the best practice for each scenario. For example, should I first use the Merge node and then the Split Out node, or is there a more efficient way? What is the core difference between Aggregate and Summarize when it comes to counting and calculations?

I’d appreciate it if someone could clarify the ideal scenarios and workflows for using these powerful nodes.

What is the error message (if any)?

There is no error message. This is a question about best practices and conceptual understanding.

Please share your workflow

{
“nodes”: [
{
“parameters”: {
“fieldsToAggregate”: {
“fieldToAggregate”: [
{}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.aggregate”,
“typeVersion”: 1,
“position”: [
-1740,
2060
],
“id”: “1e777687-d648-44b7-ac74-77967269b785”,
“name”: “Aggregate10”
},
{
“parameters”: {
“options”: {}
},
“type”: “n8n-nodes-base.splitOut”,
“typeVersion”: 1,
“position”: [
-1300,
2040
],
“id”: “f84ad7f0-369c-45e8-ba77-b99bb440d993”,
“name”: “Split Out4”
},
{
“parameters”: {},
“type”: “n8n-nodes-base.merge”,
“typeVersion”: 3.2,
“position”: [
-1080,
2040
],
“id”: “ec9af05f-0a46-4967-9705-7f2372db3069”,
“name”: “Merge3”
},
{
“parameters”: {
“fieldsToSummarize”: {
“values”: [
{}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.summarize”,
“typeVersion”: 1.1,
“position”: [
-860,
2040
],
“id”: “589c72d2-0837-4c8a-a3b5-29f14c219978”,
“name”: “Summarize3”
}
],
“connections”: {
“Aggregate10”: {
“main”: [
[
{
“node”: “Split Out4”,
“type”: “main”,
“index”: 0
}
]
]
},
“Split Out4”: {
“main”: [
[
{
“node”: “Merge3”,
“type”: “main”,
“index”: 0
}
]
]
},
“Merge3”: {
“main”: [
[
{
“node”: “Summarize3”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “b914b727c7e48e90b2806df064caf0a1601e762e5d73b65a3ed2ae68c9e0f94b”
}
}

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

none

Information on your n8n setup

  • **n8n version:1.95.3
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • **Running n8n via (Docker, npm, n8n cloud, desktop app):**npm
  • **Operating system:**windows

Merge

When there are two kind of data object. You want to merge them into one.

Like

// User
{
  "uid": "12345",
  "name": "John"
}

// Contact
{
  "uid": "12345",
  "phone": "0000000000"
}

Then you can merge based on uid

Split Out

// 1 item
[{
  "data" : ["1", "2", "3", "4", "5"]
}]

// after split out
// 5 items
[
  {
    "data": "1"
  },
  {
    "data": "2"
  },
  {
    "data": "3"
  },
  {
    "data": "4"
  },
  {
    "data": "5"
  }
]

Aggregate :

// 5 items
[
  {
    "data": "1"
  },
  {
    "data": "2"
  },
  {
    "data": "3"
  },
  {
    "data": "4"
  },
  {
    "data": "5"
  }
]

// after aggregate
// 1 item
[
  {
    "data": [
      "1",
      "2",
      "3",
      "4",
      "5"
    ]
  }
]


Summarize :

[
  {
    "data": "1"
  },
  {
    "data": "2"
  },
  {
    "data": "3"
  },
  {
    "data": "4"
  },
  {
    "data": "5"
  }
]

// after summerize and count
[
  {
    "count_data": 5
  }
]

Example workflow


What is the core difference between Aggregate and Summarize when it comes to counting and calculations?

counting and calculations => You can choose Summarize


should I first use the Merge node and then the Split Out node

It will depend on the beginning of the data. Is it mulitple items or one item contains data.
You can check the workflow shows how many items to tell.

1 Like

Thanks so much

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