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

how to use nested if condition in tmap

I have one decode. I want to convert it into if-else condition of talend in tmap
decode(v_DURATION,'PERPETUAL',NULL,NULL,NULL,'Duration:' ||v_DURATION)


Thanks in advance,
Kiran.
Labels (2)
2 Replies
willm1
Creator
Creator

Kiran - let me give this a stab... In plain English, here's what your statement translates to:
if v_DURATION = PERPETUAL then Null
else if v_DURATION = Null then Null
else 'Duration:' ||v_DURATION
Using ternary operators in tMap, the standard is "test condtion ? true : false"
row1.v_DURATION !=null && !row1.v_DURATION.isEmpty() ? (row1.v_DURATION.equals("PERPETUAL")? null : row1.v_DURATION.equals("NULL")? NULL : "Duration: " + row1.v_DURATION) : ""
To avoid the pervasive nullpointer exception, I first check to make sure v_Duration has a non-Null value...
Anonymous
Not applicable
Author

thanx willm