
Anonymous
Not applicable
2011-05-13
04:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[resolved] How to devide a BigDecimal value...
Hi *,
using tMap, I'm trying to devide a BigDecimal vaule by 100. Pretty simple, I thought.
Source and target fields are BigDecimal, but by using the following syntax I get an error like: "Exception in component tRowGenerator_1" by clicking the 'Test'-Button in the expression editor of the target field.
What is the mistake?
Thank you!
Ben
using tMap, I'm trying to devide a BigDecimal vaule by 100. Pretty simple, I thought.
Source and target fields are BigDecimal, but by using the following syntax I get an error like: "Exception in component tRowGenerator_1" by clicking the 'Test'-Button in the expression editor of the target field.
new BigDecimal(100).divide(row1.theUltimateValueWhoNeedsToGetDevidedBySomething)
What is the mistake?
Thank you!
Ben
759 Views
1 Solution
Accepted Solutions

Anonymous
Not applicable
2011-05-13
09:07 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey Lijo,
thank you for your help! You pushed me into the right direction!
I found a second problem in my syntax: I muddled up the source value and the division value; for example:
100 divided by 15 (false)
instead of
15 divided by 100 (correct)
So the code is now working, I just needed to swap those values in the code, thanks again!
thank you for your help! You pushed me into the right direction!
I found a second problem in my syntax: I muddled up the source value and the division value; for example:
100 divided by 15 (false)
instead of
15 divided by 100 (correct)
So the code is now working, I just needed to swap those values in the code, thanks again!
row4.MWST_SATZ.divide(new BigDecimal(100),java.math.MathContext.DECIMAL32)
759 Views
6 Replies

Anonymous
Not applicable
2011-05-13
04:43 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is the error I get by running the job:
no exact representable decimal result.
at java.math.BigDecimal.divide(Unknown Source)
759 Views

Anonymous
Not applicable
2011-05-13
07:15 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is nobody able to help me out on this issue?
759 Views

Anonymous
Not applicable
2011-05-13
07:38 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
use
new BigDecimal(100).divide(row1.theUltimateValueWhoNeedsToGetDevidedBySomething,RoundingMode.HALF_UP)
use
new BigDecimal(100).divide(row1.theUltimateValueWhoNeedsToGetDevidedBySomething,RoundingMode.HALF_UP)
759 Views

Anonymous
Not applicable
2011-05-13
08:12 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you!
But now Talend is telling me that 'RoundingMode' cannot get resolved... Would it be better to change the data type into double or something like that?
But now Talend is telling me that 'RoundingMode' cannot get resolved... Would it be better to change the data type into double or something like that?
759 Views

Anonymous
Not applicable
2011-05-13
08:24 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Sorry i didnt give fully
write java.math.RoundingMode.HALF_UP instead of RoundingMode.HALF_UP
Sorry i didnt give fully
write java.math.RoundingMode.HALF_UP instead of RoundingMode.HALF_UP
759 Views

Anonymous
Not applicable
2011-05-13
09:07 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey Lijo,
thank you for your help! You pushed me into the right direction!
I found a second problem in my syntax: I muddled up the source value and the division value; for example:
100 divided by 15 (false)
instead of
15 divided by 100 (correct)
So the code is now working, I just needed to swap those values in the code, thanks again!
thank you for your help! You pushed me into the right direction!
I found a second problem in my syntax: I muddled up the source value and the division value; for example:
100 divided by 15 (false)
instead of
15 divided by 100 (correct)
So the code is now working, I just needed to swap those values in the code, thanks again!
row4.MWST_SATZ.divide(new BigDecimal(100),java.math.MathContext.DECIMAL32)
760 Views
