You are not logged in.
Announcement
Unanswered posts
|
Pages: 1
Hi folks,
Just wondering if it is possible to create if-else statements in the tMap expression builder. If you could give some examples it would be much appreciated.
Thank you in advance!
Offline
Thanks. I was also looking for this and it worked fine. Is there a reference for all these syntax. I dont find it in the user guide or reference guide. I am not a java developer and would like to learn these just for the purpose of using talend effectively.
kp.balaji123 wrote:
Thanks. I was also looking for this and it worked fine. Is there a reference for all these syntax. I dont find it in the user guide or reference guide. I am not a java developer and would like to learn these just for the purpose of using talend effectively.
Unfortunately, there is no a document for these syntax, but you can always learn these knowledge and experience from Talend forum.
Offline

Hi everyone,
How about this expression at tMap? Could you please help me on the Java syntax?
Example expression at output ColumnC,
if row1.Year_ID < 2009
2000+row2.ColumnA
else
2008+row2.ColumnA
For '+', it's concatenating the value rather than actual add operation.
Your help is very much appreciated!
Last edited by Rozie (2013-02-06 19:11:37)
Offline

What if..
Year_ID is int
ColumnA is double
output ColumnC is double
row1.Year_ID < 2009 ? 2000+(Integer.parseInt(row2.ColumnA)) : Integer.parseInt(2008+row2.ColumnA)
I tried but it returns error.
Please help me, thanks!
Offline

Hi Alevy,
Sorry, looks like I didn't think hard. tConvertType simply solved my problem.
But I have another problem, what if I have 3 conditions?
Is my design correct?
row1.Year_ID < 2009 ? 2000+row2.F0015 : row1.Year_ID = 2009 ? 2008+row2.F0015 : 2012+row2.F0015
Thanks ![]()
Last edited by Rozie (2013-02-07 04:47:02)
Offline
Pages: 1