IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

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
  • 1.  Flow or java service?

    Posted Fri October 05, 2007 12:35 PM

    Hi,

    I have to write a service for the following rule

    If a = 0 then b=VALUE
    If Value.Length > a then insert “.” at position (Value.length-a)
    if Value.Length <= a then concat “0.” and x times “0” (where x=a-value.length) and VALUE.

    For eg.:
    VALUE=2846 and a=2 then the output should be 28.46
    and if VALUE=870 and a=5 then the output should be 0.00870.

    is there any method of doing this in flow? or its only possible with java? what shud be the logic for java service?


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 2.  RE: Flow or java service?

    Posted Fri October 05, 2007 01:47 PM

    There is no problem to do this in flow :wink:


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 3.  RE: Flow or java service?

    Posted Fri October 05, 2007 04:57 PM

    Noramlly I’d say write it using FLOW. But in this case you can leverage the BigDecimal class to do this for you. Take a look at the moveDecimalLeft method.

    Structure the service this way:

    name: movePointLeft
    inputs: value, n (both as strings)
    outputs: value (a string)

    Get value and n from the pipeline using IDataUtil methods (getString and getInt respectively)
    Create a new BigDecimal object, passing value to the constructor
    Call the BigDecimal.movePointLeft method, passing n
    Call the BigDecimal.toString method and put the returned string in the var named value in the pipeline


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services