Coverting String to BigDecimal

Hi,

  1. How a String can be converted to BigDecimal(java.math.BigDecimal) type?

I have an input value as a string which is actually a number. I need to pass it to a JDBC adapter service which is accepting only java.math.BigDecimal type.

  1. How a string can be converted to date type. It is not just formatting the string structure, but the data type needs to be changed as a JDBC adapter service is expecting a date type as input.

Are there any sevices available to achieve the above two or do we need to write java services?

Thanks in anticipation.

Best regards,
KRV.

You can use wMTransformation package for such changes or you can write your own java service. You need to use following piece of code:

java.math.BigDecimal val = new java.math.BigDecimal(String obj, MathContext.DECIMAL32);

1 Like

Thanks Vikas for your help.
I used the below services as suggested by you.
WmTransformationServices:StringToDate
WmTransformationServices:StringToBigDecimal

Hi Vikas Gupta and Ravi Varma K,

Even I have the same requirement as Ravi Varma. I tried searing for the package WmTransformations on SAG Tech community and on google but I am unable to find this package.

Can you please share me the path where I can download the package.

Your help is highly appreciated.

You can use below service.

pub.math:toNumber

Hi Akash,

I do not find the service pub.math:toNumber in wM 7.1.2.

I guess you are referring to wM 8.1.2 or higher? I guess we may have to write a java service for this requirement.

Hi M@he$h,

            In wM 8.2.2, we have pub.math:toNumber service.

Thanks Akash… I will check this :slight_smile: