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.  filtered mapping in a loop

    Posted Wed February 08, 2006 05:51 AM

    Hello,

    my problem is that I have to map one list into another list but I don’t want to map all list elements. List elements which don’t match to a special expression should not be mapped.

    My solution now is

    LOOP input array: array1  output array: array2
    BRANCH 
    map if array1.name = abc into array2
    map if array1.name = cdf into array2
    map if array1.name = efg into array2
    
    

    The problem is that also elements which shouldn’t be mapped have a empty node in the output array.

    Is there another way but first to make a new list containing only the elements I’m interested in and then loop over this new list to map the elements?

    Thanks Sabrina


    #webMethods-General
    #Integration-Server-and-ESB
    #webMethods


  • 2.  RE: filtered mapping in a loop

    Posted Thu February 09, 2006 12:25 AM

    Hi Sabrina,

    Consider the built-in-services pub.list.appendTo... instead of using the output array. This way you can easily build a new list of values that can be of a different length than the source array.
    

    Regards,
    Adrian


    #webMethods-General
    #Integration-Server-and-ESB
    #webMethods


  • 3.  RE: filtered mapping in a loop

    Posted Thu February 09, 2006 10:49 AM

    Hello,
    Yes services appendToStringList and appendToDocumentList are the common way for constructing a reduced size destination list from a particular source. It is a predifined entry on map steps under the Transformer tab button. Good day.

    Yemi Bedu


    #webMethods
    #Integration-Server-and-ESB
    #webMethods-General


  • 4.  RE: filtered mapping in a loop

    Posted Thu February 09, 2006 11:05 AM

    Note that appendToStringList and appendToDocumentList performance does not scale well, because it requires allocating and filling a new array object on each call. If they are being called 100s of times or more, it would be better to use services that work on a true List object.

    See WmSamples sample.complexMapping.largeDoc.messageBuilder createList, addToList and listToArray.

    The usage would be

    createList
    Loop
    map
    addToList
    listToArray
    
    

    #webMethods-General
    #webMethods
    #Integration-Server-and-ESB


  • 5.  RE: filtered mapping in a loop

    Posted Mon February 13, 2006 03:54 AM

    Thanks a lot, as there is no better way to solve
    the problem I will do it this way.

    Sabrina


    #Integration-Server-and-ESB
    #webMethods
    #webMethods-General