How to use below SQL case statement While using tmap component

Eight Stars RAJ
Eight 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

Thanks
RAJ
Sixteen Stars TRF
Sixteen 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
Seven Stars med
Seven 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

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog