Convert Excel data type IF Java

Hi everyone I want to convert an specific Excel column to integer when it loads in double datatype. For that I am using a Java If (Table) but I am unable to write the code properly

I am doing these attempts

if ($${SCOLUMN TO INTEGER II}$$ = "Number (double)") {
 return 0;
}
else {
 return 1;
}

The other one

if ($${SCOLUMN TO INTEGER II}$$.equals(Number (double))) {
 return 0;
}
else {
 return 1;
}

Thank you

03 Convert Datatype.knwf (179.8 KB)

Hi @mauuuuu5,
why so complicated? Can’t you just use a Double To Int node? If the column is there and a double, it will convert it. Otherwise it is ignored.
Kind regards
Alexander

2 Likes

Hi Alex, I have the same question? but the final user does not want to deal or read any column datatype, just want to press run and see it converted.

Thank you

Mau

but the final user does not want to deal or read any column datatype, just want to press run and see it converted.

And what is wrong with the Double To Int node then? The user does not have to configure anything. The node will simply cast any double column to integer. If only some should be cast, you can also use a wildcard or regex pattern in the second tab of the column selection configuration.
Kind regards
Alexander

1 Like

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