Customize table column

I’ve got the following table like this:

col1 col2
A A1
A A2
A A3
B B1
B B2
B B3

now i want convert it like this:

A B
A1 B1
A2 B2
A3 B3

Anybody can help me ?
Thanks !

Hi there!

This was interesting but maybe I got it! Use Column Expressions node as many times as there is Groups (A,B,…) with expression

if(column("col1")=="A")
    column("col2")

and column name of your group. You will get column with missing values for all groups except A group. After that you can filter column you don’t need (all except A column). After that use Row filter node to filter out missing values. Repeat this for all groups and use use Column Appender node :slight_smile:

It could be optimized I guess :smiley:

Instead of Column Expressions node you can use Rule Engine node as well.

Br,
Ivan

1 Like

Hi Ivan,
Thanks for your reply! I’m new to knime and i try to understand your solution,but still don’t know how to do it.
could you offer me a demo workflow file?
Thank you very much again!

Sure.
Ivan

Customize table column.knwf (14.2 KB)

1 Like

Hi Ivan,
I got it ,thank you very much again!

You are welcomed :wink:
Ivan