[solved] Create bitmask based on changes in a column

Hi,

I have a column with the content [1,1,1,4,4,5,5,5]. I want to know in which rows the changes occur from one row to the next one. I marked the ones bold: [1,1,1,4,4,5,5,5] in other words, I want something like [1,0,0,1,0,1,0,0].

I see the following possibilities but do not know to to use KNIME:

  1. Loop through the column and compare the previous row with the current row in a JavaSnippet, create a new row ant write 1 oder 0. But in the Java-Snippet, I can only access complete column...
  2. Take  the column, create a copy, add an item in the first row of the copy and a last only on the original. Then substract both columns and I get non-zeros values at the rows with the change. But in KNIME I cannot add a cell to only one column.

Can you please help me with my problem?

spider

Hi spider,

please find attached a workflow that hopefully solves your problem. Don't hesitate to ask if anything is unclear with the workflow or it doesn't help.

Best,

Martin

Hi hornm,

thanks very much. You used my 2nd idea and used the "Lag column" node in KNIME to add an additional row. I haven't known this node.

I modified your KNIME workflow to use fewer nodes and attached it.

Kind regards from spider