Hi, in my code, when I run on website everything work ok. But I have recieved this message. "Attempting use IndexOf on a list while it's being iterated". I don't know where I have this message cause when I debug all my code everything work success.

Anybody have this Error Message.

Thanks

Hi Dat Bui,

Please check which list you are iterated in this you are using some split string use specific Position

like- listname.list[0].text.value 


provide some code images or anything that will help to understand.

Regards

Rahul Sahu

Rahul Sahu wrote:

Hi Dat Bui,

Please check which list you are iterated in this you are using some split string use specific Position

like- listname.list[0].text.value 


provide some code images or anything that will help to understand.

Regards

Rahul Sahu


Hi Rahul,


Hi Dat Bui,

Are you appending to the list you are iterating?

If so then first copy the list that you itterate, and append to the copy.

Regards,

Daniel

Hi Dat Bui,

After reading out the error (Error: "Attempting use IndexOf on a list while it's being iterated") and referring the shared action flow Logic, I guess that the error is occurring because of the assignment node, which you might have defined in any of the server action flow as mentioned below:



Reason: On the server side, variables of List data type have a reference to the values and don't contain a copy of the elements. For example, if you have two lists List A and List B and you assign List A to the List B, you will have two variables pointing to the same list instead of two independent copies. When changing values in one variable, the other is also changed.


Refer the below mentioned documentation page for more details: 

https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Data/Data_Types/List


Hope this helps you!


Regards,

Benjith Sam