Loop inside Lopp issue?

Hi All,

I am trying to sort StringList using a Flowservice and am initializing the outer loop like i->0
Loop over itemList
–Seq i<size
do something
initializing j = i+1
Loop over itemList
–Seq j<size
do something(swapping logic to exchange values like temp = a[i],
a[i]=a[j] and
a[j]=temp)
j=j+1
i=i+1
But the control is not getting transfered inside the inner loop
What went wrong. Help is highly appreciated:confused:
Regards,
Datta

As many will attest, I’m a big proponent of writing most services in FLOW. However, in this case I must ask why are you doing this? There is a sort method available in the IS Java API that you can use to sort the list. You do not need to reimplement a sort. Indeed, it usually boggles my mind when anyone writes a sort from scratch–in the vast majority of cases it just isn’t necessary.

Hi Datta,

In the first loop when you are traversing, the “itemList” becomes a single String in each iteration and not a StringList. And so when you try again to loop over the itemList it can not loop over since there is no StringList as it was before outer loop statement and so not getting into the inner loop. You may need to duplicate your stringList and use the original one in outer loop and duplicated one in inner loop depending on the kind of sort you are trying to implement. Hope this would help you to give an idea of where it is going wrong.

  • Dinakar.