Help with FOR or WHILE Loop in Column Expressions Node

Hello KNIMERs,

I have the following situation with returned inventory:

  1. For a given Category, and Item, a negative Amount is entered. Many returns are possible.

  2. These negative returns also show IsConsumed = ‘0’ to indicate this amount is not used in final production.

  3. The goal is to remove a SINGLE matching positive record for each negative return.

  4. The end result should be only 1 line per legitimate IsConsumed = 1. In this case, I only want the yellow OR green boxes to flow through.

I am using the Column Expressions Node with the code below to create a new column Overwrite that should show ‘1’ if IsConsumed == ‘0’ AND it’s corresponding IsConsumed == ‘1’ line.

Here is the output I currently get:

Here is the output I want after using a Row Filter to remove OverWrite = ‘1’:

I suspect that I need a FOR or WHILE loop to iterate over each Item, but I am not sure.

I am attaching a sample workflow with dummy data. Any help would really be appreciated!

Haystack

Inventory Returns.knwf