webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Coverting String to BigDecimal

  • 1.  Coverting String to BigDecimal

    Posted Fri February 21, 2014 01:53 PM

    Can a String 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.

    Are there any built-in services available out of the box to achieve this. I tried searching it in WmPublic (v7.1.2) pkg but no joy…

    Can anyone please help me with this or do I have write a java code to do this?

    Any suggestions or ideas is highly appreciated.


    #webMethods
    #Integration-Server-and-ESB


  • 2.  RE: Coverting String to BigDecimal

    Posted Fri February 21, 2014 04:33 PM

    I think writing a few lines of Java code is the easiest way of doing this.


    #Integration-Server-and-ESB
    #webMethods


  • 3.  RE: Coverting String to BigDecimal

    Posted Wed February 26, 2014 07:25 AM

    Hi mahesh

    You will have a service in wmtransformations package which is used to convert string to big decimal, Please check for this package.

    let me know if you require any help.

    Regards
    Sandeep


    #webMethods
    #Integration-Server-and-ESB


  • 4.  RE: Coverting String to BigDecimal

    Posted Wed February 26, 2014 01:11 PM

    Hi Sandeep,

    Can you please share the package and do the needful :slight_smile:

    I tried find it on SAG tech community and on Google but I was not able to find anywhere.


    #Integration-Server-and-ESB
    #webMethods


  • 5.  RE: Coverting String to BigDecimal

    Posted Fri February 28, 2014 04:02 AM

    Hi Mahesh,

    You can try using this service pub.math:toNumber which is un WmPublic package.

    Regards,
    Sireesha


    #webMethods
    #Integration-Server-and-ESB


  • 6.  RE: Coverting String to BigDecimal

    Posted Fri February 28, 2014 04:12 AM

    Hi Sireesha,

    Yes you are correct but unfortunatley this service is not present in wM 7.1.2 :frowning: we are not upgraded yet.

    If you have Wmtransformations pkg kindly share it to me.

    Thanks,
    Mahesh


    #Integration-Server-and-ESB
    #webMethods


  • 7.  RE: Coverting String to BigDecimal

    Posted Fri February 28, 2014 06:25 AM

    I dont have that package…

    But can you try this java code…

    public static final void convertString(IData pipeline) throws ServiceException {
    // pipeline
    IDataCursor pipelineCursor = pipeline.getCursor();
    String inString = IDataUtil.getString( pipelineCursor, “inString” );
    pipelineCursor.destroy();
    BigDecimal output = BigDecimal.valueOf(Long.parseLong(inString));
    // pipeline
    IDataCursor pipelineCursor_1 = pipeline.getCursor();
    //Object output = new Object();
    IDataUtil.put( pipelineCursor_1, “output”, output );
    pipelineCursor_1.destroy();

    }
    

    Hope it works for you…

    Thanks,
    Sireesha Avala


    #Integration-Server-and-ESB
    #webMethods


  • 8.  RE: Coverting String to BigDecimal

    Posted Fri February 28, 2014 10:50 AM

    We cannot share packages here and please check the share ware section also in this forum.

    http://techcommunity.softwareag.com/codesamples

    HTH,
    RMG


    #Integration-Server-and-ESB
    #webMethods


  • 9.  RE: Coverting String to BigDecimal

    Posted Fri February 28, 2014 10:56 AM

    @ Sireesha Avala,
    I will have a look at your code. Thanks :smiley:

    @ rmg,
    We have many code samples here. Let me see if I can find Wmtransformations pkg. Thanks :smiley:


    #webMethods
    #Integration-Server-and-ESB