How to keep item linking through different nodes after code nodes?

Hello,

So I’m building a flow with n8n with different data entry points, everything works find until I use a code node, then when I try to use the data from previous nodes it don’t work because items are not linked anymore. I don’t understand how to make them linked. So I can access all the data from all the previous nodes, in all the next nodes before and after the following codes nodes.

So…

How to keep item linking through different nodes after code nodes ?

Thank you.

Hey @antoine.mai hope all is well. Welcome to the community.

When you write an expression you can use the following format:

{{ $("Node name").fields.you.need.to.get }}

This will allow you to access the data, returned by the nodes, which are not directly connected to the current one.

See this page for details:

Sorry but this doesn’t seems to work. I’ve tried with: {{ $(‘Set parameters’).image_name }}

Well if you share your workflow I can look into it.

Here is how to share the workflow: link.

Here is an example for you to look at:

Here is a part of the flow.

First code block, I can still access data from previous nodes, code node two I can’t (it work because i’ve done some things, but it’s not how I want it), there are more codes nodes later were I really need to understand how to access the data because it’s more complicated.

Could you explain again, which node needs to access which field of which other node?

For example I would like to access image_parameters from ‘set parameters’ in split wms urls.

Here are the following nodes and they also need access to data from ‘set parameters’ & ‘parcel merging’.

It is difficult to think of the best way to achieve that, because I can’t execute most nodes and also I don’t understand the idea of what is happening here in the workflow, but here is the question, if you need to split out the image_parameters in the Split node, do you even need to connect the Code node to the Split node?

I’ve connected the code node to the split no because I would like to have it’s data in the fetch wms images node.
But I could link the set parameters & code node directly to de split node and it would work I think, but is this correct ?

But here the real problem, I would like to have access to the parcel merging & image parameters node data from overlay polygon on image node. That the important and difficult part…

There is always an option to bring the values from the previous node by using the merge node like this

Okey that’s fine for one block, but if i’ve 20 it becomes a mess if I need to merge from 20 different sources to 20 code nodes.

Others question, why merge and not just link then ?

I don’t understand why the linking works for the first code nodes but not for the others…

The reason for needing to have a merge is that we want to achieve some sort of synchronization, as we need two inputs to enter the node at the same time, where as if you connect two inputs directly, the first input that comes will trigger the next node, you can see an example of this behaviour here

Notice how I introduced a delay on the bottom branch, which cause the top branch to hit the “Edit fields2” and “activate” it.

Okey I understand why now, thank you.

But my main issue still isn’t solved… Anyone else has an idea ?

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