Six Stars

How to use below SQL case statement While using tmap component

Hi Talend Folks,

                      I need to convert the below SQL case statement While using tmap component in talend

 

(SUM(case
when t1.NET < 0
then (t1.NET*-1)
else
t1.NET
end)) AS NET

2 REPLIES
Twelve Stars TRF
Twelve Stars

Re: How to use below SQL case statement While using tmap component

Hi,

Just get the absolute value of NET field:

Capture.PNG

Hope this helps.


TRF
Six Stars med
Six Stars

Re: How to use below SQL case statement While using tmap component

Hello,

 

You can use the tMap variables and do your query using the Talend's condition :

 

row1.myKey.equals("FirstValue")?1:0

 

In your case, you will create variable which value is t1.NET*-1 if t1.NET < 0 else t1.NET and after you will map your variable to the ouput and add the sum function to the variable.

 

Thanks,

Med

 

Thanks,

Med