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
Expand all | Collapse all

Compare a String Variable

  • 1.  Compare a String Variable

    Posted Thu March 09, 2006 12:10 PM

    Hi ,
    In the flow services(Mapping service ) i would like to compare a String variable with an initialised variable using a transformer …I have checked the pub.String folder and i could not find a CompareTo Util in it …
    IS there something like compareTo() function that we use in java …

    regards
    Dhiraj Shetty


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


  • 2.  RE: Compare a String Variable

    Posted Thu March 09, 2006 02:42 PM

    Dhirah Sheety,

    Why do you need to do the comparison in a Map step? Are you looking for a lookup function to transform a value?

    Mark


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


  • 3.  RE: Compare a String Variable

    Posted Thu March 09, 2006 05:32 PM

    you can simply create a java service with two input params and one output as follow:

    [highlight=java]
    String out = “”;
    // pipeline
    IDataCursor pipelineCursor = pipeline.getCursor();
    String field1 = IDataUtil.getString( pipelineCursor, “field1” );
    String field2 = IDataUtil.getString( pipelineCursor, “field2” );

    if (field1.equalsIgnoreCase(field2))
    out = "true";
    else
    out = "false";
    

    // pipeline
    IDataCursor pipelineCursor_1 = pipeline.getCursor();
    IDataUtil.put( pipelineCursor_1, “value”, out);

    pipelineCursor.destroy();
    pipelineCursor_1.destroy();

    [/highlight]

    and calling it from every flow you want.

    Hope this can help you
    Regards,
    VS


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


  • 4.  RE: Compare a String Variable

    Posted Thu March 09, 2006 06:08 PM

    Dhiraj,

    There is a sample service called string:compareString in PSUtilities.zip package,get this useful package from Advantage.webmethods.com.

    Just copy the service in your custom package/folder and invoke it in your flow,it should work.

    Elese flow with VS shared custom Javaservice above.

    HTH,
    RMG


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


  • 5.  RE: Compare a String Variable

    Posted Fri March 10, 2006 10:11 AM

    Hi Mark,
    You are right i need a look uo function for Transformer inorder to compare an IS-Doc variable with a constant varible …
    I do not want to use a Java Service for the same do i am trying to explore the functions in the Web-Methods package …The built-In pub.String utility has limited functionalities…

    Thanks for taking your valuable time out …

    Thanks and regards
    Dhiraj Shetty


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


  • 6.  RE: Compare a String Variable

    Posted Fri March 10, 2006 10:18 AM

    Hi RMG,
    Thanks for the PSUtilies …I have tried it …But we canot use the Third Party tool in our project …

    Thanks and regards
    Dhiraj SHetty


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


  • 7.  RE: Compare a String Variable

    Posted Fri March 10, 2006 10:20 AM

    Hi VS,
    I have tried Java service for the same but i wanted to explore the Flow service for the same as Java service has to be used to the mininal as per architiecture …
    Is there a tranformer which compared 2 Strings…

    thanks and regards
    DHiraj Shetty


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


  • 8.  RE: Compare a String Variable

    Posted Fri March 10, 2006 03:41 PM

    Dhirak,

    Its not a thirdparty tool,it is developed by webMethods Professional services and these are not avail in WmPublic.This is gone thru by almost everyone.

    Just copy the service into your package/folder and invoke it in your flow service and test end to end,you can customize the service at your own risk.

    Also you can invoke java services as a transformer same you do for built-in service which accomplishes the same.

    HTH,
    RMG


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


  • 9.  RE: Compare a String Variable

    Posted Fri March 10, 2006 03:52 PM

    The built-in service provided by webMethods are just java services (and occasionally Flow services). Creating a simple service to act as a transformer that compares two strings is a perfect example of when it is OK to use a java service instead of a Flow. That is, what you want to create is a small, discrete piece of functionality that does not already exist in the IS built-in services.

    Your only Flow option is to use a BRANCH statement to evaluate your variable and multiple (redundant) MAP statements to perform the conditional mapping. As an architect, I would much prefer writing a java service to provide this utlity function over having redundante MAP steps. Both approaches will work, one is “brute force” and one is elegant.

    Mark


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


  • 10.  RE: Compare a String Variable

    Posted Mon March 13, 2006 03:02 PM

    Dihraj,

    I was reading through this post and I was trying to understand what exactly you are trying to accomplish with this service, but I’m not sure if I was able to. Somewhere along the post, I saw that all you are trying to do is a look-up of some sort. Is that correct?

    If so, then have you looked into the pub.string:lookupTable service?

    • Percio

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