webMethods

webMethods

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.  Loop iteration

    Posted Thu July 07, 2016 11:02 AM

    how to start iterating a loop in webMethods from any index other than 0?. Ex: if there is an array of 10 elements, what can be done to start iterating from 3rd element?


    #Integration-Server-and-ESB
    #webMethods


  • 2.  RE: Loop iteration

    Posted Thu July 07, 2016 12:17 PM

    write down a java service which takes a list and gives you a list. Inside it, start from index which you desire ?

    Thanks,


    #Integration-Server-and-ESB
    #webMethods


  • 3.  RE: Loop iteration

    Posted Sun July 10, 2016 07:40 AM

    Hi, You can use the variable $iterator to skip the particular iteration. Just use it in you condition to skip based on your business logic


    #Integration-Server-and-ESB
    #webMethods


  • 4.  RE: Loop iteration

    Posted Mon July 11, 2016 08:49 AM

    Java service is not required here. Just loop step and branch on $iteration must do it.


    #Integration-Server-and-ESB
    #webMethods


  • 5.  RE: Loop iteration

    Posted Mon July 11, 2016 06:36 PM

    Although I agree that it may be the simplest option for this example, using a BRANCH step is not the same as starting from the nth element. If starting from a specific element is the actual requirement, I agree with the previous post that creating a Java service is the best way to accomplish this. You could also use a REPEAT step and then use variable substitution to reference a specific index in the list. Neither option is great though but that’s because this is an unusual requirement for webMehtods.

    So, is this just a general question or is there an actual business requirement behind it? If the latter, please share it and perhaps we can lead you down a better path.

    Percio


    #Integration-Server-and-ESB
    #webMethods


  • 6.  RE: Loop iteration

    Posted Tue July 12, 2016 03:27 AM

    Thank You for the replies!
    @Percio Castro …This was just a general question.

    I tried using both java Service and branch steps. Of the two using Java Service is the better option, coz using branch steps will make the flow service more complex.
    Also it’ll be more complex to use branch if we change the starting index for different executions.

    Regards,
    Sheel Priya


    #Integration-Server-and-ESB
    #webMethods