Continue workflow if "IF" sees everything is false

Describe the problem/error/question

Is there a way to continue the workflow if everything returned is false?

What is the error message (if any)?

No error messages. The “IF” statement works as expected. If everything is false, the workflow stops but I don’t want this to happen.

Please share your workflow

Share the output returned by the last node

Workflow fails if everything returned from LLM is false

Information on your n8n setup

  • n8n 1.52.2:
  • Database (SQLite):
  • n8n EXECUTIONS_PROCESS setting (own, main):
  • Running n8n via Docker:
  • Operating system: UnRAID

It looks like your topic is missing some important information. Could you provide the following if applicable.

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

@rainmanjam , it’s just a matter of engaging “false” output of the node. If you want to continue looping over the items, connect “false” output of the IF node with the input of the Loop.

@ihortom If I do that, the following will happen:

If, in the loop, every LLM response returns false, the workflow will stop as successful and not continue.

hello @rainmanjam

What do you mean by “continue”? What should it do in that case?

@barn4k What I’m trying to do, based on a list of base keywords, is find news articles and evaluate them on the LLM to see if they match my niche. If it’s a match, save it to nocodb. I’m running into an issue if the LLM returns false for everything for all of the articles in the batch, the workflow would complete successfully instead of continuing with the next loop (picking up another keyword to pass to HTTP Request.

@rainmanjam , I think you need to rebuild your workflow with two loops. As nested loops are not encouraged, here’s the improvised solution to demonstrate what I mean. Hopefully you can correlated it with your own workflow.

The idea is to

  1. Accumulate all the article titles for your keywords in the 1st loop
  2. Evaluate them with LLM in the 2nd loop

Note: ignore me setting the title names with expression ["A{{ $runIndex }}", "B{{ $runIndex }}"] - this is just to make the titles unique and show you what loop iteration they belong to. In actuality, with each iteration of the 1st loop you should get different titles as well as different number of titles.

@ihortom I tired that before and it failed. I just went back to the drawing board and made it work this way.

I hate to run the HTTP Request that long without storing its results somewhere, but it works for now. I may refactor the code later.

2 Likes

@rainmanjam , yes, that is what I meant. Technically the 1st loop is not required - without the loop you would get the same result. The 2nd loop is doing the job you had trouble with.

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