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.  string from a string list

    Posted Thu July 16, 2009 05:38 PM

    Hi,
    I want to check if a particular string is existing in a given string list.
    example : lets say the string list has 1, 2, 3, 4, 5 and if i pass 3 as a string input, it should return me (yes or no) or (true or false).
    do we have something this kind of inbuilt service in our wm developer.
    Please let me know.

    FYI. I am using wm developer7.1.2.

    Thanks,
    Bala.


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


  • 2.  RE: string from a string list

    Posted Fri July 17, 2009 12:28 AM

    The only service I can think of is a pub.string:lookupTable in the WmPublic pacakge which takes in a String and a key and returns the value.

    If you want to return true/false, I’d suggest using a Java service to do the work.

    Something like

    
    String key = "3";
    String[] words = {"1","2","3","4","5"};
    List<String> wordList = Arrays.asList(words); 
    if(wordList.contains(key)) {
    return true;
    }
    return false;

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


  • 3.  RE: string from a string list

    Posted Fri July 17, 2009 01:16 PM

    Thanks.

    I searched for inbuilt services, but didnt find much… so we wrote one java service which served the purpose.


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


  • 4.  RE: string from a string list

    Posted Fri July 17, 2009 03:17 PM

    Java is one way. The same can be done in FLOW as well. And can be debugged using Developer. Here are the steps for a service that accepts a string list name myList and a string to look for name myValue and returns a var name found:

    MAP (set found = false)
    LOOP over ‘/myList’
    …BRANCH (evaluate labels = true)
    …%/mylist% == %/myValue%: SEQUENCE
    …MAP (set found = true)
    …EXIT ‘$loop’ and signal SUCCESS


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


  • 5.  RE: string from a string list

    Posted Fri July 17, 2009 03:46 PM

    yes, i did this before. but we want to avoid using loop because we have a string list of various folder names ranging from 2000 to ~. this way loop takes much time


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


  • 6.  RE: string from a string list

    Posted Fri July 17, 2009 05:00 PM

    If performance is really a concern, then maybe you should consider different approaches to help speed up the look up, such as using hash tables or sorted lists.

    • Percio

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