List was redefined while being iterated

List was redefined while being iterated

  

Hi everyOne, I have this error and I don´t know how to solve it


List was redefined while being iterated


Can you help me , please?, I would really appreciate that

Hi Jose,

Can you share your oml?

Is it happening on mobile or web?

kind regards,

Remco Dekkinga

Hello José,

With this little information is very difficult to give good help.

Anyway, this error happens when you are iterating a list (using a ForEach), and change the list (do a ListClear, or ListAppend or ListRemove, for example)

You can't change a list you are iterating.

Instead, if you need to change the list, clone the list (I think the action is ListDuplicate), and iterate the copy. Than you can change the original.

Cheers

Eduardo Jauch

Hi Jose,

Could you please provide us more details like when you are getting this error, A screen shot or oml can also help me to understand your problem.

Sachin

Eduardo Jauch wrote:

Hello José,

With this little information is very difficult to give good help.

Anyway, this error happens when you are iterating a list (using a ForEach), and change the list (do a ListClear, or ListAppend or ListRemove, for example)

You can't change a list you are iterating.

Instead, if you need to change the list, clone the list (I think the action is ListDuplicate), and iterate the copy. Than you can change the original.

Cheers

Eduardo Jauch

Hi Edurado, I was also expecting all above reasons to be possible cause of error, However I have never come across it before. Nice explanation by the way!!

Sachin


Remco Dekkinga wrote:

Hi Jose,

Can you share your oml?

Is it happening on mobile or web?

kind regards,

Remco Dekkinga

is happening in mobile 


Since it is on mobile, it could be that you are refreshing the record list at different moments (OnReady, OnLoad, etc). Can you doublecheck that this is not happening?

If this and the solution of Eduardo don't solve your issue, can you share the espace that gives the issue?

Regards, Remco

Sachin Mahawar wrote:

Eduardo Jauch wrote:

Hello José,

With this little information is very difficult to give good help.

Anyway, this error happens when you are iterating a list (using a ForEach), and change the list (do a ListClear, or ListAppend or ListRemove, for example)

You can't change a list you are iterating.

Instead, if you need to change the list, clone the list (I think the action is ListDuplicate), and iterate the copy. Than you can change the original.

Cheers

Eduardo Jauch

Hi Edurado, I was also expecting all above reasons to be possible cause of error, However I have never come across it before. Nice explanation by the way!!

Sachin


Normally when you do that, the error is this


"clear"/"append"  is not valid operation inside a stariteration/endinteration block, but this is diferent, I have not found in the web about this error specifically 



José Ángel Paredes Sánchez wrote:

Remco Dekkinga wrote:

Hi Jose,

Can you share your oml?

Is it happening on mobile or web?

kind regards,

Remco Dekkinga

is happening in mobile 


Normally when you do that, the error is this


"clear"/"append"  is not valid operation inside a stariteration/endinteration block, but this is diferent, I have not found in the web about this error specifically 



Hello José,

If you are not explicitly changing the list in an ForEach and given you are in a Mobile app, I would say that investigating the moments where you are doing refresh to the List, like Remco said is the way.

The error is simply: The list is change during iteration. But this can happen, for example, while the list is being rendered in the screen. As the lists, in mobile, are "lazy loaded", it is possible that you are updating the list before the rendering process is finished, for example.

If you can't share the OML for business reasons, can you provide more information? How is your screen being set up, what you have in the screen, have you any JavaScript with setTimeouts and so on that will do automatic updates to the list in the screen?

Cheers,
Eduardo Jauch