Problem in passing data of previous node to the current node

Hello everyone,
I’m currently running n8n locally using Docker on my laptop, and I’ve encountered an issue while developing my workflow.
Problem:

  • I want to pass the output data from the “Extract Details” node to the “Pass Programs” node, which appears later in the workflow. However, the “Pass Programs” Code node does not receive all the data produced by “Extract Details.”
    Observations:
  • The “Extract Details” node outputs 7,621 items across 326 iterations inside the loop.
  • The “Pass Programs” node only outputs 326 items (one per iteration), and all items contain the same content, as shown in the image.
    Questions:
  • Why does this behavior occur, and how can I fix it so that all extracted data is correctly passed to the “Pass Programs” node?
    Thank you for taking the time to read my question. I’d really appreciate any help or insights.

1 Like

Hi, I think your workflow should look like this, but I can’t test it on my side. the output of the loop node can help also to verify that theory before trying it…

1 Like

hello @Nestor , thank you for your response. I have tried your approach but the “Pass Changes“ code node still doesn’t work as expected. The output of the loop node is 327 items including: 326 items in the loop branch ( each one is one day and it’s program schedule data), the last item is in the done branch with 326 output for the “Detect Changes1” node.

He shared it up in the conversation

the response of Wouter is correct tell if you need help to do so.

1 Like

Thanks @Nestor I missed his initial code share.

@TrinhNhatHuy your Pass Cahnges code node should merge the arrays like this:

2 Likes

Thank you @Wouter_Nigrini and @Nestor for providing your approach. I have tried your code, but it still does not work as expected.

The purpose of the “Pass Programs” node is to pass all data from “Extract Details”, and “Pass Changes” is to pass all data from “Detect Changes”.

[
  {
    "date": "2025-01-01",
    "programs": [
      {
        "__EMPTY": "2025-01-01T00:00:00.000Z",
        "__EMPTY_1": "1899-12-31T06:00:00.000Z",
        "__EMPTY_3": "Chiến Binh Ninja Mỹ (Phần 13)",
        "_sheetName": "T1 UP",
        "_fileName": "AXN NAM 2025.xls",
        "_fileSize": "37.7 MB"
      }
    ]
  }
]

Here is the workflow and error log

i have provide an example of the output of my Loop Over Items node in the first iteration, its an array contains date and another array of programs.

Hey @TrinhNhatHuy
this was he initial workflow:

You managed from our suggestion to use a subworkflow to use “split” the nested looping…
And it seems you just “eliminated” the initial loop, instead where actually your problem is… 1 item(can contain an object with multiple arrays/objects.)… and you seems that you have items (and it means maybe you need to splitout to iterate again trough them)…

Soo.. pinning data in the critical points as well is advides since some of us don t ue some sevices(personally i don t have mysqlq)..

And try first put on paper your flow(not the workflow)… then try put nodes that accomplish some tasks.

What are you doing at moment, is just circleying around lol.
Explain to us what you want to achieve and some informations.
Cheers!

@Parintele_Damaskin Sorry for your confusion but the one you answered for me the previous day was another problem of another workflow. That was a nested loop problem and i solved it because of your help (very appreciate that).

I have defined my problem very clear in this situation above where i cannot pass the data from one node to another one. I want to pass the data correctly. I always try to provide as much information as i can like pin the data. However, you already known there is the length limit or html_raw here so i will try as much as i can. Thank you so much!

1 Like

Hey @TrinhNhatHuy !

As i have assumed, you still don tget how looping or nested loop works in n8n…anyway, @Wouter_Nigrini already “pointed” you in the right direction…

Beside that, some code nodes that have an overkill code just for some smple inflate/split array/objects ito items and procces i woul have apporoahhe d different path since is just “comparation” you are trying to achive at the end, and that s why i commented

For example :

And about pinning data, yea is hard, but you can provide a file somewhere so we can test somhow locally(and i ma not using mysql as well lol) :slight_smile: ….

Anyway, hee is what i achieved to do from what i understoo(hence, i am not fully aware of your table schema, the file dtata etc.):

Cheers!

2 Likes

thank you @Parintele_Damaskin i have try your approach and the Pass Programs node still cannot pass all the data from the Extract Details node. i dont understand why in another workflow i try the same approach of passing the data, it worked but this one doesnt. If the behavior is correct, the output of Pass Programs node should be 7621 items. Here is the file i use as input of all my workflow: gg drive

hey @TrinhNhatHuy !
Yea, that behaviour is known since clears its internal buffer every time a new loop starts… and some “twiks” are needed look for internal executions details.

*I used your file and it get 763, but the principle should be the same.

As you can see, now the pass program has the Extract details, and the pass changes gets the changes only.

and here is some vusual:

pep4ewx4

And here the workflow(no pinn data lol..)

I am not a sql master, neither a Js guru…
Cheers!

3 Likes

@Parintele_Damaskin Finally, I was able to solve the problem. Thank you so much for your guidance—I understand it now!
Have a great day and Happy New Year :tada:

1 Like

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