Describe the problem/error/question
It looks like the nested loop over items does not work properly. Or I don’t understand how it works.
For example, I have a very simple workflow. The input data is JSON:
[
{
"name": "First item",
"code": 1,
"nodes": [
{
"id": 1
},
{
"id": 2
}
]
},
{
"name": "Second item",
"code": 2,
"nodes": [
{
"id": 3
},
{
"id": 4
}
]
}
]
My target is to print to console all IDs (1, 2, 3, and 4).
I’ve created a loop for items and a nested loop for going through all id’s one by one
Also, I have Code blocks with prints to the console.
I simplified the workflow because in ьн real complex workflow I have exactly the same problem with nested loops
What is the error message (if any)?
When I execute my workflow I expect that I will get the following result in DevTools console:
[Node: "Code1"] =====================
[Node: "Code1"] Code: 1
[Node: "Code3"] Id: 1
[Node: "Code3"] Id: 2
[Node: "Code1"] =====================
[Node: "Code1"] Code: 2
[Node: "Code3"] Id: 3
[Node: "Code3"] Id: 4
But in fact, I got the result:
[Node: "Code1"] =====================
[Node: "Code1"] Code: 1
[Node: "Code3"] Id: 1
[Node: "Code3"] Id: 2
[Node: "Code1"] =====================
[Node: "Code1"] Code: 2
Please share your workflow
Share the output returned by the last node
It is strange that on the third step, I see IDs 3 and 4 on the ‘Done’ branch in the second Loop element
Information on your n8n setup
- n8n version: 1.18.0
- Database (default: SQLite): SQLite
- n8n EXECUTIONS_PROCESS setting (default: own, main): own
- Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
- Operating system: Ubuntu 22.04.1 LTS
Thanks in advance!