Hi everyone
I'm thinking this is a forall and a collection thing, but I can't really figure how to bring it together.
In my Sharepoint list I have Procedures and each procedure has steps. In Powerapps, every time I add a new step(new record for that procedure) it will increment the step number for the given procedure. So some Procedures might have five steps and others 20+. So this all works great until I delete step 4 for example and instead of the following steps e.g 1,2,3,4,5 I would get 1,2,3,5. I was wondering how I could re sequence/ rewrite the numbers on my list straight after I delete a step giving me a result like 1,2,3,4.
Thank you for your time
Hi @Corissandageri ,
I'm still surprised as well how seemingly complex things can be done with small formulas whereas seemingly simple things can take many, many lines of formulas.
If my post resolved your issue, please mark it as the solution so other members of the community can find it more easily.
Hi BCBuizer
I didn't think this could be done with such minimal formula, The + icon was adding a step in the wrong place, but then I remembered I had to sort my gallery. Thank you
Hi @Corissandageri ,
In the below example I have added icons to the gallery that allow to insert or remove steps whilst updating the sequence numbers of the existing steps. Basically it relies on saving the number of the step to be added/removed in a local variable (locNumber), then updating the sequence number of the steps after the step to be added/removed and finally the adding/removal of the item itself:
The references you probably will need to change to make this work for you are:
ThisItem: this refers to the item to be added/removed, which may look like Gallery1.Selected
colNumbers: this refers to the data source
Number: this refers to the column in the data source that has the sequence numbers
WarrenBelz
146,605
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,946
Most Valuable Professional