Duplicate rows with a specific multiplier


is there a possibility do duplicate a row or rather multiply by a specific number from the table?
For example i have a table like this:

In the end it should look like this:

so the row should be duplicated as often as the factor in Col2 indicates and if Col2 is for example LIKE 2 there should be the same Row for 2 times.
It is important that the 2 should then be divided by itself in the output table. (Col2 must always be 1)

I hope this is reasonably understandable :slight_smile:

Many thanks in advance.

Hi Knimer17,

you can do this e.g. with two nested loops:

The Chunk Loop Start iterates the input rows one-by-one. Then I extract the “number of repetitions” using a flow variable in the Table Row to Variable which is fed into the second Counting Loop Start node. Both loops need to be terminated using a Loop End node.

At the end, I replace all column2 values with a constant of 1 using the Rule Engine:

You can get the workflow from my NodePit Space:

Does this help?



HI there @Knimer17,

welcome to KNIME Community!

Well you can take advantage of One Row to Many node to avoid loops. After it simply use Math Formula to get 1s in your column.


Here is example wf:
2020_02_17_RowMultiplication2.knwf (12.4 KB)



Hello Philipp,

thanks for your answer.

Maybe you could look at my reply below to Ivan, it is a bit more complicated than I thought.

Maybe you can find a solution to my problem

Many thanks.

Hello Ivan,

many thanks for your fast answer.

Forgot to say that my input table is a bit more complicated. It looks like this

In the end it should look like this:

So all rows of Col2 should be divided by the first number (in red: 1,3,2) if Col1 stays the same. So the rows with x’s remain because they will be divided by one. The lines with Y are divided by 3, so from the previous 3 lines a total of 9 lines.

A bit hard to explain but I hope you can understand.

Thanks for your help.
Best regards

1 Like

Hi Knimer,

for this case you’ll most definitely need some nested loops. I suggest you have a look at the WF which I posted and see how this can be adapted to your case.

Beside the Loop nodes which I already used, I’d recommend to have a look at the Group Loop Start node.

Bonne chance!

Never worked with loops in my knime career (has started not even 3 weeks ago).

So it will be hard but I’ll give it a try and keep you guys updated.

Hi @Knimer17,

possibly this workflow do the same without looping. The only assumption is, that your data are in the correct order and the multiplication of the rows is performed on the first row for each unique entry in Col1 (group condition).

HermannDemo 1 Demo 2 DEMO.knwf (71.8 KB)


Hi @morpheus,

thanks, already found a similiar solution as yours, not as difficult as I thought.



Hi @Knimer17,

sometimes you don’t see the wood for the trees. :wink:


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