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?
write down a java service which takes a list and gives you a list. Inside it, start from index which you desire ?
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
Java service is not required here. Just loop step and branch on $iteration must do it.
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.
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.