Error Checking - Check Sums

I’d like to include some check sums as error checks in a workflow I’m building. For example, if I do an inner join between two tables, I’d like to make sure that all of my data found a match. I’d like it to throw an error and stop the workflow from finishing if the total number of rows decreases in one table before and after the join. Any ideas on how to do something like that?

Hi @stevelp , there are a few ways to do this, and by “this” I am referring to the implementation of “if (some condition) is not met, then stop the workflow”.

You can use an IF Switch and the Fail In Execution node which basically can stop the workflow from continuing

Just make sure that you are properly implementing the condition (make sure that all of my data found a match). If you need help with that part, you will need to share some sample data and let us know which fields are the joining fields.

1 Like

Hi @stevelp , I put a quick demo together for your.

The demo workflow looks like this:

To keep it simple, it’s simply checking if the number of rows match the given number from the Variable Creator, in this case it’s set to 5:
image

And indeed there are 5 records in the table:
image

So the condition is satisfied, and the workflow continues to the end to the String Manipulation, as you can see in the first screenshot.

Now, to make the workflow stop and not finish, we need to make the condition not satisfied. We can either add/remove a record from the table, or we can modify the variable count. Let’s modify the variable count instead:
image

So, when I try to execute the workflow until the end, it actually stops before that:

As you can see, the IF Switch routed to the bottom because the condition is not satisfied (5 rows found vs the 4 that was set) as opposed to the top when the condition was satisfied, and at the bottom route, the Fail in execution node kicks in and stops the workflow. You can see that none of the nodes after the Fail in execution node are executed.

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

3 Likes

This is great @bruno29a. You might also consider the Breakpoint node for this case as well, as it provides a few additional options.

5 Likes

I’m just wondering, if your tables have not a huge number of unique keys then you can use Group by node with set aggregation for both tables and compare those aggregates. Only if all keys are present on both tables aggregates will be equal.

1 Like

Nice @ScottF , thanks for sharing. Is that a relatively new node? I don’t recall seeing this before, well I mean when I was first looking for way to halt a workflow (about a year ago when I first started using Knime). I only found the Fail in execution node at that time.

It’s an interesting one, in that you can implement the logic to stop directly into the Breakpoint node itself without the need for the IF Switch.

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