# Create the new columns using existing columns and previous columns created

Hi everyone,

I am the beginner and glad to join the KNIME community.
I need help in creating new columns using certain rules based on existing columns in knime.

For exemple :

I have the table with 2 columns Don_1 and Don_2.

I’d like to create the news columns Don_i (with i frome 3 to 20). These new columns base on the Don_1 and Don_2 and the previous columns created, for exemple in the photo:

It would be so nice if anyone could help me.

Hello @doremon,

and welcome to KNIME Community!

This seems like it would require a recursive looping for which I’m a bit lazy so let’s try to solve this with math.

Formula for C column can be written as B2(1+1/A2)
Formula for D column can be written as B2(1+1/A2) + B2(1+1/A2)/A2 which equals
B2(1+1/A2)(1+1/A2) = B2(1+1/A2)^2
Formula for E column should be then B2(1+1/A2)^3
And so on…

This way you can use single node to achieve your output. For example Column Expressions node and write one expression for each column you need. If you want to automate this further put Column Expressions between Counting Loop Start and Loop End nodes. You can control power with currentIteration flow variable from loop start node. This requires a bit work but is doable.

Disclaimer: I’m a bad mathematician so check above equations.

Br,
Ivan

3 Likes

Hi @ipazin ,
Thank you for the solution! That’s great and it works
Best regards

1 Like

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