Accessing `false` items of an `if` node – after exiting a loop

Describe the problem/error/question

I’ve built an self-improving loop in which an AI suggests a (netter) title for a new podcast idea, which is then fed into a second AI which rates the suggestion according to a given ruleset; resulting in a score and a reason as explanation to the score. If the last variant of the title reaches a score above a certain threshold, an if node breaks the loop and the result can be passed on to the following nodes. In the end, I’d love to have an array of suggestions (along with scores and explanations for the score), so what I am trying now is to somehow access all items in a code loop following the exit-if node. But: I can only access the latest iteration – or the true result so to speak. I have no idea how to access all items that end up in the false branch of my if node.

Please share your workflow

Share the output returned by the last node

The last output is the last item. The only one that passes to the true branch of the exiting if node. It has a title, a score and a reason.

Information on your n8n setup

  • n8n version: 1.86.1
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): own
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker (coolify)
  • Operating system: Debian (docker)

You need to wire the “hanging” branch of your If node back to the Loop node. Then you will have all items that passed through the loop at the Loop’s done output. There you can Filter out items per your requirements.

2 Likes

Ahhh, that makes total sense. Thank you very much!

1 Like

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