How to multiply big decimal number with -1 value

Eight Stars RAJ
Eight Stars

How to multiply big decimal number with -1 value

Hi talend folks,

 

How to multiply big decimal number with -1 value. 

My column name is data (big decimal).

data column value like (344.0,344.0). 

I want to multiply below calculation in tmap.

calculation:

Case when ART = 'R' and SOLL = 'S' then data *- 1
when ART = 'R' and BEN = 'S' then data
else 0

kindly share your information.

Thanks
RAJ

Accepted Solutions
Fifteen Stars TRF
Fifteen Stars

Re: How to multiply big decimal number with -1 value

Hi,

Assuming your data flow is called row71, fields are named as in your question and data datatype is BigDecimal, here is the solution:

(row71.ART == 'R' && row71.SOLL == 'S') ? row71.data.multiply(new BigDecimal(-1)) :
	(row71.ART == 'R' && row71.BEN == 'S') ? row71.data : (new BigDecimal(0)) 

the tMap with the expression:

Capture.PNG

and the result for different values:

.---+----+---+----.
|   tLogRow_36    |
|=--+----+---+---=|
|ART|SOLL|BEN|data|
|=--+----+---+---=|
|R  |S   |S  |-100|
|R  |X   |S  |100 |
|R  |X   |X  |0   |
|X  |X   |X  |0   |
'---+----+---+----'

 


TRF
Fifteen Stars TRF
Fifteen Stars

Re: How to multiply big decimal number with -1 value

Did this help?
If so, thank's to mark your case as solved.

TRF

All Replies
Fifteen Stars TRF
Fifteen Stars

Re: How to multiply big decimal number with -1 value

Hi,

Assuming your data flow is called row71, fields are named as in your question and data datatype is BigDecimal, here is the solution:

(row71.ART == 'R' && row71.SOLL == 'S') ? row71.data.multiply(new BigDecimal(-1)) :
	(row71.ART == 'R' && row71.BEN == 'S') ? row71.data : (new BigDecimal(0)) 

the tMap with the expression:

Capture.PNG

and the result for different values:

.---+----+---+----.
|   tLogRow_36    |
|=--+----+---+---=|
|ART|SOLL|BEN|data|
|=--+----+---+---=|
|R  |S   |S  |-100|
|R  |X   |S  |100 |
|R  |X   |X  |0   |
|X  |X   |X  |0   |
'---+----+---+----'

 


TRF
Fifteen Stars TRF
Fifteen Stars

Re: How to multiply big decimal number with -1 value

Did this help?
If so, thank's to mark your case as solved.

TRF
Eight Stars RAJ
Eight Stars

Re: How to multiply big decimal number with -1 value

Thank you @TRF

Thanks
RAJ

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 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch