Five Stars

Cannot Convert from Float to BigDecimal Error: Tried with java syntax new BigDecimal.

 Hi All,

 

I have got this error while loading data, I tried with java syntax new BigDecimal: Kindly help me.

 

Error: Cannot Convert from float to BigDecimal.

 

Talend Team Please comment on this.

 

Error.pngError_1.png 

5 REPLIES
Employee

Re: Cannot Convert from Float to BigDecimal Error: Tried with java syntax new BigDecimal.

I'm not sure the error is happening where you think it is.   Perhaps switch to the code view and see more info on where it's happening. 

 

Also, converting from a float to a BigDecimal isn't perfect since float is not an exact numeric. You may want to consider rounding to specific number of digits to get more exact.  What you show should compile, though. 

 

new BigDecimal(field, new MathContext(3, RoundingMode.HALF_EVEN))

 

Five Stars

Re: Cannot Convert from Float to BigDecimal Error: Tried with java syntax new BigDecimal.

Thanks for reply.

 

Code error is Exception with Type Mistmatch: Cannot convert Float to BigDecimal.

 

tried our code too but error not resolved.

Request talend team to look into this.

 

 

Employee

Re: Cannot Convert from Float to BigDecimal Error: Tried with java syntax new BigDecimal.


jagadesh-raj wrote:

 

tried our code too but error not resolved. 


 

Hi, I think the error is occurring somewhere else in our job (not what you are showing in your screenshot). I was suggesting to look at the code tab to see more specifically where the error is. 

 

 

 

 

 

Six Stars

Re: Cannot Convert from Float to BigDecimal Error: Tried with java syntax new BigDecimal.

Hi

 

Have you used TypeConvert routine in Talend?

 

Please try with TypeConvert.Float2BigDecimal(floatvalue)  where floatvalue is the value from source and assign the output to Target.

 

Velu.

Five Stars

Re: Cannot Convert from Float to BigDecimal Error: Tried with java syntax new BigDecimal.

Hi Velu,

 

Thanks for your reply, I'm getting same Type Mismatch error again no change at all with your expression.

 

Regards,

Jagadesh