
Anonymous
Not applicable
2014-04-14
10:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to convert bigDecimal to double
Hello,
I have a AS400 database that contains data with decimal type.
when I loaded the data ,Talend convert the Decimal type to BigDecimal .
And for the destination I have a postgres database .
when I made the connection between the two databases using a tmap component. this error msg appears:
Exception in thread "main" java.lang.Error: Problèmes de compilation non résolus :
Non concordance de types : impossible de convertir de BigDecimal en double
Non concordance de types : impossible de convertir de BigDecimal en double
Non concordance de types : impossible de convertir de BigDecimal en double
I have a AS400 database that contains data with decimal type.
when I loaded the data ,Talend convert the Decimal type to BigDecimal .
And for the destination I have a postgres database .
when I made the connection between the two databases using a tmap component. this error msg appears:
Exception in thread "main" java.lang.Error: Problèmes de compilation non résolus :
Non concordance de types : impossible de convertir de BigDecimal en double
Non concordance de types : impossible de convertir de BigDecimal en double
Non concordance de types : impossible de convertir de BigDecimal en double
977 Views
8 Replies

Anonymous
Not applicable
2014-04-14
12:02 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi asterisks,
first Talend use a Xml file to Map DB type to JavaType (also known as Talend Type) and 'vice-versa'.
There is no implicit cast between type.
So you can't change the way Talend Map conversion Type by Default.
You have to convert type if necessary ; for that purpose use tConvertType.
BE AWARE about java type for decimal and loosing precision with floating type like Float & Double
hope it helps
regards
laurent
first Talend use a Xml file to Map DB type to JavaType (also known as Talend Type) and 'vice-versa'.
There is no implicit cast between type.
So you can't change the way Talend Map conversion Type by Default.
You have to convert type if necessary ; for that purpose use tConvertType.
BE AWARE about java type for decimal and loosing precision with floating type like Float & Double
hope it helps
regards
laurent
977 Views

Anonymous
Not applicable
2014-04-14
05:44 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You will not losing any precision if you only transfer data also on Double.
You should use an expression in your tMap:
row1.my_big_decimal != null ? row1.my_big_decimal.doubleValue() : null
You should use an expression in your tMap:
row1.my_big_decimal != null ? row1.my_big_decimal.doubleValue() : null
977 Views

Anonymous
Not applicable
2014-04-15
04:25 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi all,
Because floating-point numbers have a limited number of digits, they cannot represent all real numbers accurately: when there are more digits than the format allows, the leftover ones are omitted - the number isrounded.
You mean if you make any calculation on decimal and JUST propagate value through the flows !?
regards
laurent
Because floating-point numbers have a limited number of digits, they cannot represent all real numbers accurately: when there are more digits than the format allows, the leftover ones are omitted - the number isrounded.
You will not losing any precision if you only transfer data also on Double
You mean if you make any calculation on decimal and JUST propagate value through the flows !?
regards
laurent
977 Views

Anonymous
Not applicable
2014-04-15
07:17 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hello Mr.JLOLLING,
Can you please tell me,where exactly I'll put the expression....
Regards,
Can you please tell me,where exactly I'll put the expression....
Regards,
977 Views

Anonymous
Not applicable
2014-04-16
04:00 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Please have a look at screenshot
Best regards
Sabrina
Please have a look at screenshot
Best regards
Sabrina
977 Views

Anonymous
Not applicable
2014-04-17
07:00 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hello,
it works, thank you a lot
Best regards
it works, thank you a lot
Best regards
977 Views

Anonymous
Not applicable
2014-04-17
07:07 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for your feedback. Could you please click the "Set this topic as resolved" link which is right underneath your initial post? This way, other users will be informed that this thread has been resolved.
Many thanks
Best regards
Sabrina
Thanks for your feedback. Could you please click the "Set this topic as resolved" link which is right underneath your initial post? This way, other users will be informed that this thread has been resolved.
Many thanks
Best regards
Sabrina
977 Views

Anonymous
Not applicable
2016-04-08
04:57 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@jlolling
Thanks for the expression
May you can give a short exaplaination what he expression does
Will be helpful
Additional: Could i use the expression for an Fieldlookup also or only for mapping.
Thanks in advance
regards fireskyer
Thanks for the expression
May you can give a short exaplaination what he expression does
Will be helpful
Additional: Could i use the expression for an Fieldlookup also or only for mapping.
Thanks in advance
regards fireskyer
977 Views
