Combining Consecutive Same Value Rows

Hi I am trying to combine consecutive same value rows however I am unable to find a reasonable method to do so.

 

Example:

159291
440348
81549
485128
439796
138031
439846
1438
62093
472
472
472
472
472
472
470
470
470
470
760
82611
161
2683871
280689
288931
472
280533
280974
281031
163

 

I need to maintain the ones that are by them self, for example 472 should appear twice, once after 62093 and once after 288931. Is there an easy workflow to acheive this?

Thanks.

You could also solve it with the Java Snippet node.

Connect a Java Snippet node and in the global declaration field define a field "lastKey" (Int, last seen Key) and "Use" (int, use this value). In the method body field, define a script such as:

if (!$Key$.equals(lastKey)) {
  Use = 1;
} else {
  Use = 0;
}
lastKey = $Key$;
return Use;

The return type of the script is an integer. You can add this column and then filter on it.

Hi,

you can do this using the Moving Aggregation node (which is my new favourite node, thanks to Tobias :)).

See the attached workflow. The idea is to use a window of size 2 and count the Unique Values in it. Next filter all rows which got only one unique value in this window of size 2.

Cheers, Iris