Add value to column

Hi all,

I have two tables so far: I would like to add 1,3,5,7 … in the column sort…

image

In my second table I would like to do the same only with 2,4,6,8…

image

Can someone help me? Which node suits best? Thanks you a lot!

Best,
Markus

Hi @Markus3003

You can use.

The Min Value: is the start value (here 1 and 2) ,
Scale Unit, the steps to take (here 2)

gr. Hans

6 Likes

Is there maybe another solution?
The node “Counter Generation” is not available in my knime.

Thx and BR
Markus

Hi @Markus3003 , another alternative is you can look into the Moving Aggregation and then adjust with Math Formula

You should try to get the Counter Generation though, it’s a very useful node.

EDIT: I ended up putting something together with what I suggested above:
Table 1 results:
image

Table 2 results:
image

Workflow looks like this:
image

And here’s the workflow: Add odd and even incrementals to two tables.knwf (14.8 KB)

4 Likes

Hi @Markus3003

You can make the Counter Generation node (and all other nodes from the Data Generation Extension) available in your knime by drag and drop the node from the KNIME Hub onto your canvas and follow the instructions from KNIME.
gr. Hans

4 Likes

Hello there!

One can also use Math Formula with following expressions for

odd numbers:
$$ROWINDEX$$ * 2 + 1

and even numbers:
($$ROWINDEX$$ + 1) * 2

Br,
Ivan

7 Likes

Nice one @ipazin ! Didn’t think of that

1 Like

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