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.  Duplicate documents

    Posted Fri July 22, 2005 05:17 AM

    Hi
    I have a doc list which has a set of documnets in which some are duplicate.how can i get a doclist of distinct documents from this doclist?
    The duplicate docs have all the elements same…
    problem doclist resultant doclist
    should look like this
    eg:- doclist
    doc[0]
    str1-a
    str2-1
    doc[1]
    str1-b
    str2-2
    doc[2]
    str1-a
    str2-1

    resultant doclist should look like this

    doclist
    doc[0]
    str1-a
    str2-1
    doc[1]
    str1-b
    str2-2


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


  • 2.  RE: Duplicate documents

    Posted Fri July 22, 2005 06:52 PM

    You can write a service to go over these docs and create a doc list of distinct docs, but it wouldn’t be very efficient; I suggest looking into the process that populated this doc list e.g., if its from some rdbms try optimizing the query by adding distinct keyword in select sql etc.,


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


  • 3.  RE: Duplicate documents

    Posted Fri July 22, 2005 07:00 PM

    Hello,
    Get the length of the list. Build a service that can do a recursive call, passing the whole list and the starting index. In this call, pull out the document to represent that position index. loop compare to all elements whose index is higher than yours. If you find a match, do nothing. If you do not find a match, append to a return list. Then do another recursive call passing the new higher index and the same doc list. You keep going until index >= length and then return the list. At the end the top most call will have a list whose elements are distinct and the oldest copies (lower index) will have been removed. I leave how you compare the elements up to you as this can work with many types. Good day.

    Yemi Bedu.


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