Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Talend Folks
How to convert below query for tmap in talend
if(indicator='L',
if((Type='C' or Type='N') and len(Id)>2,0,
if(Name='P' or Name='R',0,Qty)
as I wrote above - calc number of conditions
first test this:
row1.indicator.equals("L")?
(row1.Type.equals("C")||row1.Type.equals("L") )&&(StringHandling.LEN(String.valueOf(row1.Id)))>2?
0
:(row1.Name.equals("P")||row1.Name.equals("R") )?
0
:row1.Qty
:null
it will work
than - check where miss logic
row1.indicator.equals("L")?
--- begin true 1
(row1.Type.equals("C")||row1.Type.equals("L") )&&(StringHandling.LEN(String.valueOf(row1.Id)))>2?
--- begin true 2
0
--- begin false 2
:(row1.Name.equals("P")||row1.Name.equals("R") )?
--- begin true 3
0
--- begin false 3
:row1.Qty
???? where false 1 ????
:null ---- (as variant)
in other words - each IF must include both part IF YES and IF NOT
try this:
row1.indicator.equals("L")?
(row1.Type.equals("C")||row1.Type.equals("L") ) && StringHandling.LEN(row1.Id) >2?
0
:(row1.Name.equals("P")||row1.Name.equals("R") )?
0
:row1.Qty
Hi vapukov
Thanks for your immediate reply.
when I ran your query I am getting expression to complete error. Here I enclosed the error screenshot also.
check - where You miss : or routes or () or etc
... or attach screenshot
... or need to check - condition list
? it is IF
condition ? true :other condition?true:false
need count number of conditions
Hi,
Could you please show the Expression which you written in tmap.
Thanks,
Bharath.
This is my Expression for tmap
row1.indicator.equals("L")?
(row1.Type.equals("C")||row1.Type.equals("L") ) && (StringHandling.LEN(String.valueOf(row1.Id))) >2?0 :
(row1.Name.equals("P")||row1.Name.equals("R") )? 0 : row1.Qty
as I wrote above - calc number of conditions
first test this:
row1.indicator.equals("L")?
(row1.Type.equals("C")||row1.Type.equals("L") )&&(StringHandling.LEN(String.valueOf(row1.Id)))>2?
0
:(row1.Name.equals("P")||row1.Name.equals("R") )?
0
:row1.Qty
:null
it will work
than - check where miss logic
row1.indicator.equals("L")?
--- begin true 1
(row1.Type.equals("C")||row1.Type.equals("L") )&&(StringHandling.LEN(String.valueOf(row1.Id)))>2?
--- begin true 2
0
--- begin false 2
:(row1.Name.equals("P")||row1.Name.equals("R") )?
--- begin true 3
0
--- begin false 3
:row1.Qty
???? where false 1 ????
:null ---- (as variant)
in other words - each IF must include both part IF YES and IF NOT