Using values from previous nodes - cant get data for expression

Describe the problem/error/question

Hi all.

I have a node that i am having issues with using values from previous nodes.
For example.
image

Now these values have no issues working, and i am pulling them from 1 node back.
image

When i change the input dropdown to a different node or use the edit expression option to grab previous nodes, i have no issue seeing the values i want to pull in however if i try to use one it gives me an error that i cant get data for expression

Is there a special way to pull in multiple nodes?


ExpressionError: Can’t get data for expression
at createExpressionError (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/WorkflowDataProxy.js:465:20)
at getPairedItem (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/WorkflowDataProxy.js:517:27)
at pairedItemMethod (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/WorkflowDataProxy.js:734:40)
at Object.get (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/WorkflowDataProxy.js:737:40)
at Proxy.eval (eval at getFunction (/usr/local/lib/node_modules/n8n/node_modules/@n8n/tournament/dist/index.js:24:22), :6:57)
at Tournament.execute (/usr/local/lib/node_modules/n8n/node_modules/@n8n/tournament/dist/index.js:33:19)
at evaluateExpression (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/ExpressionEvaluatorProxy.js:110:16)
at Expression.renderExpression (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Expression.js:217:70)
at Expression.resolveSimpleParameterValue (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Expression.js:195:34)
at resolveParameterValue (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Expression.js:276:25)

Information on your n8n setup

  • n8n version:
    Docker, Onprem, Community, latest build

Thanks for all the help.

Welcome to the community @Petero!

The issue is probably that you did not provide the pairedItem information in the Code-Node. How to do provide it, is documented here:

Hey Mate.

Thanks for the welcome.

So just to confirm.

My Node GetLastMexWOID has a output that looks like this.

image

Now the next node in line “Mobaro2Mex” has the input set as my last node being GetLastMexWOID

And the mapped values pull in fine

Now if i change the input on my “Mobaro2Mex” node to node “Item Lists” which is 3 nodes back, i can see all the values on the input screen

So now i will add a new parameter to the body of the node called “WorkOrderDescription” and add the value linked to “name” in the “Items Lists” Node. You can see the data is pulling in.

Now from what i can tell, the issues start to arise when there are more then one array returned which i split out using the “Items List Node”.

So when i am in my current final node " Mobaro2Mex" having set the value
{{ $(‘Item Lists’).item.json.name }} for the Work Order Description

Where the input “Item Lists” now shows i have 2 items and using the schema view to link the fields

And Table View in input Looking like this

image

i now get an error in the node.

image

I am trying to run this api call as many times as needed with the values of each row and the api will reply back with all the remaining required fields that i then need to post back in on another step ( haven’t got to that part)

Now, given all the values are mapping correctly in the input views do i still need to do this item linking thing and if so do i need to do that javascript in the values of this node?

Cheers

Jo @Petero, did you add the paired/linked item logic to your code as suggested by Jan above?

If not you could alternatively consider using legacy expressions like {{ $node['Item Lists'].json.name }} which do not rely on these properties to be available, but you would need to make sure that neither the order nor number of your items change in this case.