Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
RAJ6
Contributor III
Contributor III

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.

Labels (2)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

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:

0683p000009Lt1d.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   |
'---+----+---+----'

 

View solution in original post

3 Replies
TRF
Champion II
Champion II

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:

0683p000009Lt1d.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
Champion II
Champion II

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

Thank you @TRF