Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am new to Talend and trying to write a pretty simple if statement in the tmap to translate a text field to a booleen. The input will be sending a "Y" or "N" and I have to convert it to True or False for the conversion. I have it written like this: IF(row1.shut == "Y", true, false) When I run my job, I get an error: The Method IF(boolean, boolean, boolean) is unidentified fro the type account. I appreciate any insight!
You cannot write an "if" statement into the tMap component.
You have to use a ternary expression like this one:
"Y".equalsIgnoreCase(row1.shut) ? true : false
If Y and N are string
Please follow below steps
row1.shut.toLowercase().contains("Y")
?
"True"
:
"False"
But before doing that you should do null check so that only you will get Y or N to output side
Thank you both! Both solutions worked. Guess I better brush up on my conversions. Got a bunch to convert to doubles. I appreciate the help.