IF Statement

I am trying to make this work

If Colum A is equal or less then 0 do plus 30 on the value in colum B. but for some reason i dont see how i can make this work

Try this:
IF Statement Column A_B.knwf (79.0 KB)

3 Likes

thanks, so i tried it after adjusting the code to:

if ( (“availability-data-catalog-xxxx.csv”) <=0 ){
(“DELIVERY_TIME”) + 30
}
else(column(“DELIVERY_TIME”))

and it doesnt do the +30 on the value in the deliverytime column

What’s the data format of delivery_time? Its got to be a number.

1 Like

both are number (integer)

Post some sample data

2 Likes

Hi @Alsmaar, welcome to the KNIME community.

Generally a screen shot or ideally an upload of what you have actually done, along with some demonstration data, will make it quicker and easier for people to assist, otherwise it’s just a guess of all possible things you may have done or not done.

2 Likes

Please let me know if this is helpful

I try to make the Delivery time go up by 30 if the availability-data-catalog-xxxx.csv column is equal or lower then 0. i tried it with a math block but couldnt make it work

Thanks, i hope the above shown can help

Hi @Alsmaar,

I just spotted that if you compare the code from @rfeigel , you will see you are missing the function keyword “column( )” around your column names

if(column("A") <= 0){
    column("B") + 30
}
else(column("B"))
2 Likes

@Alsmaar might your first option miss a column() statement in the first if/else result?

Also the else just use the other brackets {}

2 Likes

Assuming that this resolves the problem, please mark @rfeigel 's earlier post as the solution, since that provided a solution to the original question asked. :wink:

3 Likes

Aah yes that was the issue:) thanks

I’m not sure what you were doing when trying to construct the Column Expressions script. Don’t try to manually enter the columns. Single click the column button and then double click the column you want to insert. It will automatically insert where the cursor is located. The insert will be properly formatted, e.g. column(“B”).

4 Likes

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