Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Is this Talend syntax correct or am i missing a variable?
row1.Post_Key() == debit? "60" : "70"
HI Edi, glad you succeed ! you don't have to use String.valueOf() method it's already a String, and you can use the folowing syntaxe to make it null safe : "Debit".equals(row1.Post_Key)?"60":"70"
Hi could you explain the debit field ?
if debit is a string and row1.Post_Key() is a string you should use : row1.Post_Key().equals("debit")? "60" : "70"
Hi, Thanks for your reply. Yes, I have it as a string 60 is debit and 70 is credit. Should I add "credit" in front of 70? Like this.... row1.Post_Key().equals("debit")? "60" : (" credit")"70"
Hi Edi, first point it's weird to have parenthesis in your column name (Post_Key() you should avoid this in your column name),
so if row1.Post_key() is a string and is value is "credit" or "debit" and your corresponding output value is "60" or "70" then :
row1.Post_Key().equals("debit")? "60" : "70"
if if row1.Post_key() is a string and is value is "60" or "70" and your corresponding output value is "debit" or "credit" then :
row1.Post_Key().equals("60")? "debit" : "credit"
it depend of wich value you have in input and wich value you want in output.
Excellent! Thanks gjeremy. This will be helpful for me to assist me with updating it.
Hello!
I am getting an error message that it cannot convert from boolean to string. Can you please help me with this syntax to resolve error?
I tried this at first:
row1.Post_Key().equals("debit")? "60" : "70"
I received error above cannot convert from boolean to string so I cast to a string like this, below. It is still not working. I am getting error as stated above.
((String) row1).Post_Key().equals("debit")? "60" : "70"
Help please!
Where are you using it? In a Tmap ?
if it’s in a tMap could you send screenshot of the tMap and input output schema ?
If you want to convert boolean to String use: String.valueOf(Your boolean) instead of (String)(your boolean), but result will be « true » or « false »
Yes, in tMap