Four Stars

How to convert object datatype to bigdecimal/double

I am using source as ms sql in talend big data version. There is data type as Money. While fetching schema from db. The data type changed to object. Now I need to convert it to BigDecimal or Double in tmap. I Tried to use new Bigdecimal(column name).But Its not working.

Thanks in advance.


Re: How to convert object datatype to bigdecimal/double

Can you try to set the schema in your MSSQL component to Big Decimal there so that it retrieves it as a big decimal?  

If not, then you need to understand what the object contains first.  If it is a String, then you can cast the object to a String first like:


new BigDecima((String)columnname)


See the BigDecimal constructors here  

There is no constructor for generic Object type.  Hence, you will need to know what is in the Object and cast accordingly.