Sort a Cloudlist with child

Hi all.
I have a problem when I delete a child (2 in this case should be at the blue mark) The app crashes becaus number 2 now is missing.
How can I sort this list again so the list from 0 to 4 is complete.
image

1 Like

Ooohhh that’s a gooooood question! Let’s see if anyone has an answer because I am sure that sooner all later we will all come across this issue.

But let me ask this, are you using a “for” loop to iterate through the array or are you using the “for each” loop?

1 Like

If you retrieve your list using something like this
image

The objList will be a list of the numbers of your objects. Then you need to go thorough the list using the foor each loop
image

This will allow you to go through your data regardless of the numbers being sequential or not.

2 Likes

Thanks for the ideer, that schould work yes. But there is a problem.
This is what I try it your way:
And this don’t work.


But this below work fine.

Here is the DB
image

1 Like