Update numeric data field in a repeating group using Current cell's index

Hi,
I’ve this problem in my app:

Users can create tours with stages, each leg has a number field, so:

User create a tour and starts to add stages, first will have “1” number, second “2”…

let’s make,for example, tour has 4 legs, in my repeating group i will see my 4 items list, from 1st to 4th:

-leg A --> mumber 1
-leg B --> number 2
-leg C --> number 3
-leg D --> number 4

Now, if user deletes “leg C”, i will remain with legs A,B,D, and a numeric values of 1,2,4. I would like that when users delete a leg, all the “number” values of remaining legs were updated to be sequential again, taking the position from the current cell’s index if possible, in a way to get finally:

-Leg A --> number 1
-Leg B -->number 2
-Leg D --> number 3

Thanks all,
Alessandro

You need a backend workflow to change all items from the list