Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello, I have a column said CLICKS (String) that might says "Yes" and other that are all null.
"Yes" values means 1
Null values means 0
EXAMPLE:
CLICKS
1 Yes
2 Yes
3 Null
4 Null
5 Yes
I need this column in INT with numbers because I want to calculate in a BI software later.
¿How can I convert this "Yes" values into a number 1? I need to convert to int and... -- IF (COLUMN CLICKS) COLUMN CLICKS = 1 --
try this expression:
row1.CLICKS==null?0:(row1.CLICKS.equals("Yes") ? 1 : 0)
@Ivan R , You need to use below way in tmap or tjavarow after reading data .
row1.CLICKS.equals("Yes") ? 1 : 0
Thanks,
Manohar
Thank you for the response.
I put this code in a row in a tMap but I have a "java.lang.NullPointerException" when I send to a SQL Server DB
try this expression:
row1.CLICKS==null?0:(row1.CLICKS.equals("Yes") ? 1 : 0)
@Ivan R ,Agree with @Shicong Hong ,it should work.
Thanks,
Manohar
Thank You! Works perfectly.
Hi a simpler solution :
("Yes").equals(row1.CLICKS)?1:0;
Send me Love and Kudos