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: 
RAJ6
Contributor III
Contributor III

need to convert query for tmap

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)

Labels (2)
1 Solution

Accepted Solutions
vapukov
Master II
Master II

 

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

View solution in original post

6 Replies
vapukov
Master II
Master II

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

 

RAJ6
Contributor III
Contributor III
Author

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.

 0683p000009Lw62.png


Screenshot (980).png
vapukov
Master II
Master II

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

javvaji
Creator II
Creator II

Hi,

 

Could you please show the Expression which you written in tmap.

 

 

Thanks,

Bharath.

 

RAJ6
Contributor III
Contributor III
Author

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

vapukov
Master II
Master II

 

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