stop workflow if value already exisit

Hi!

I need your help again.

I need a validation that checks if a file with the same filename has already been uploaded.
Therefore: If the file name is found in a list, it should abort the workflow and show an error message “file already uploaded”.

I have created a simplified example for this.

I hope you can help me. :slight_smile:

Thanks in advance.

Hi @AndreP , there are a few ways to do this.

I put something similar a few weeks ago for another thread - can’t remember which thread it was.

The workflow looked like this:

So this kinda follows the logic you are trying to implement.

Here’s the workflow: Stop workflow from finishing.knwf (19.6 KB)

Alternatively, you can also use the Breakpoint node where you can implement the condition for stopping within the workflow itself, and even customize the error message.

I put something together that looks like this:
image

And you can configure the node like this:
image

So, because I’m using the same data as yours, and “B” exists, so the workflow does not stop.

If I change the search item to Z for example, the joiner will not have anything, so the condition of “Empty table” will be true for the Breakpoint to stop the workflow:
image

And I can see the message in the console:
image

Here’s the workflow for the Breakpoint:Stop execution on condition.knwf (12.4 KB)

Both methods are good.

EDIT: I think I reversed the logic in the 2nd method haha!

Here’s the corrected version:
image

Workflow: Stop execution on condition.knwf (14.8 KB)

5 Likes

Hi @bruno29a ,

Thank you for you answer! Looks good.

I will try it tomorrow and will give you feedback.

BR

Andre

I used the last solution and it works.
Thank you very much!
BR Andre

2 Likes

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