Column name manipulation

Hello Knimer,

my next goal is to manipulate row4 with adding a column name like in this picture:

If the product is from 204847406, then it shall add this name also in row4.

Do you have any idea which manipulation string I can use for this?

Thank you in advance :slight_smile:
Br Alex

Maybe use the Many-to-One node and then the Column Combiner?

Hi @Alex1990, I tried another approach iterating the columns to be checked.
However, it’s more complex and not so lightweight…
Z_007_col2val.knwf (26.0 KB)
Configure and try.
Greetz, Tommy

Hi there @Alex1990,

you can accomplish this by only using Column Expressions node with following syntax:

if(isMissing(column("204847406"))){
    join(columnNames()[1]," ",column("row4"))
    }
else{
    join(columnNames()[2]," ", column("row4"))
    }

Maybe you will have to modify index of columnNames() to get name of columns you need.

Br,
Ivan

Hello at all,

first to @tommy, as you said, its really no lightweight for me :smiley:
@ipazin your syntax looks useful for me, but I can not find the Column Expressions node at KNIME
Is it possible to write it in the String Manipulation? If yes, something is not working, because I get errors (you can find it at the picture)

Furthermore, I have to mention that I am a fresh beginner in KNIME :smiley:

My bad, the Column Aggregator works better here than the Column Combiner because it does not insist on quoting the spaces.

image

KNIME_project9.knwf (9.0 KB)

1 Like

Hi @Aswin

your approach was very helpful! It works. The next step I have to do, is to add a zero (if it is missing) and is it also possible to delete the spaces, that I always have the same format (check the picture

Thanks a lot :slight_smile:

1 Like

Here you go.
KNIME_project9.knwf (10.5 KB)

2 Likes

Hi there @Alex1990,

Column Expressions node is part of extension and needs to be installed. Drag&Drop it into your KNIME Analytics Platform from the link I shared or check this page on how to install extension in KNIME.

Br,
Ivan

I tried to rebuild this approach, because I have to add to the numbers in column Max_Arr[o] the sign “;”
But its not working, I guess I have to take another function, right?

And furthermoer, how can I export the final table in excel or in a .txt file?

Thank you in advance :slight_smile:

I tried it with this one but its not working neither: :-/

Hi there @Alex1990,

you can’t use two expressions in one String manipulation node. Either combine them or use this node two times.

Br,
Ivan

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