Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tMap if statement

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!

Labels (2)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

@steeld95 thanks to mark tour case as solved

View solution in original post

4 Replies
TRF
Champion II
Champion II

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
Anonymous
Not applicable
Author

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

Anonymous
Not applicable
Author

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. 

TRF
Champion II
Champion II

@steeld95 thanks to mark tour case as solved