Loop Over Items - can't get data from 3 nodes earlier

Describe the problem/error/question

I’ve got the following workflow to loop over Google Sheet rows to get GA4 data and generate insights based on that data through ChatGPT and then send it to Slack.

However, in the Slack action I can’t use the data from ‘Loop Over Items’. When I use exactly the same selector after the GA4 action, it works.

What is the error message (if any)?

When I try to use:

  • {{ $(‘Google Sheets’).item.json.slack_name }}

I get the following error message:

  • [ERROR: Can’t determine which item to use]

While this is what the data looks like:

Please share your workflow

Share the output returned by the last node

  • [ERROR: Can’t determine which item to use]

Information on your n8n setup

  • n8n version: 1.44.2
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): own, main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): web application
  • Operating system: Windows

@Fingerspitz , you cannot reference the item if there is the Loop node in between (the linking thread gets broken). However, it is still possible to achieve what you are looking for.

It’s more reasonable to get the data off the Loop node. Just replace your expression in Slack node with {{ $('Loop Over Items').first(1).json.slack_name }}. Here first(1) refers to the “loop” output (as opposed to “done”) of the Loop node.

1 Like

Thank you, that works!

I was under the assumption that I was already working with the specific object.

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