Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
EvoticTalend
Contributor
Contributor

Conditional expression in tmap

Hi everyone!

 

I have a column with this possible values:

N/A

0

1

 

 

I want it as an INT, so I have to transform this N/A values... I already have this code in the tmap:

row1.XXX.equals("N/A")?0:1 

 

0695b00000JMtnhAAD.png 

How would be the real code to transform this N/A to 0 and convert the column to int? THANKS YOU

Labels (3)
2 Replies
MattE
Creator II
Creator II

if row1.XXX is a string check it's not null or empty first

 

(!Relational.ISNULL(row1.XXX) && !"".equals(row1.XXX)?row1.XXX.equals("1")?1:0:0)

 

However, that error you're getting makes me think that either row1.XXX is not a string in tMap or that the out row is not set to Integer.

EvoticTalend
Contributor
Contributor
Author

Hi! In your code how can i put the "N/A" string?

 

Because the error still persist here for the "N/A" in an int column. I wanna say if the columns has null, blank or N/A = 0, else 1.

 

Thanks!