Duplicate cell values in rows on condition

Hello, Knime!

I've been trying to automate the simple excel stretching function: when values are scaled throughout the rows till the trigger happens. 

I have a table of values. Every row is a temporary results of some technological process. Every time the process finishes one step the value "400" in second row is created, and "X2" is written in the first row. X2 rows come through not fixed intervals.

X1 - 700 - 20170601T05:48:04

X1 - 904 - 20170601T05:48:05

X2 - 915 - 20170601T05:48:06

X1 - 400 - 20170601T05:48:07

X1 - 870 - 20170601T05:48:07

X2 - 400 - 20170601T05:48:10

I need to add one column where unique ID will be written in every row till the step is finished, then the next unique ID is written. Like in the example below:

X1 - 700 - 20170601T05:48:04 - ID1

X1 - 904 - 20170601T05:48:05 - ID1

X2 - 915 - 20170601T05:48:06 - ID1

X1 - 400 - 20170601T05:48:07 - ID1

X1 - 870 - 20170601T05:48:07 - ID2

X2 - 400 - 20170601T05:48:10 - ID2

Non of the standard KNIME functions helped. Any suggestions?


maybe you can solve it using the rule engine…
set it: “your clolumn” = X1 => ID1
"your clolumn" = X2 => ID2

if it is more complicated have a look at java snippet (simple)

I would do this in two steps:

  1. a Rule engine as @adaptagis already wrote but only for the 400 values. Column = 400 => RowIndex
    This generate a column with missing values for all non 400 values
  2. use the Missing Value node with the option next on this newly generated column. This will fill you all previous values with the next ID as well.

Cheers, Iris

Thanks! Iris’s approach did its best :slight_smile:

1 Like

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