cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JvandeKraats
Frequent Visitor

Power Apps - Move items up and down in a gallery, after deleting an item from the gallery; How can you do this?

Hello,

 

@aprildunnam shows in this nice video (Youtube link)how to organize items in a gallery (up, down, delete). Seems like a good example, because the individual actions are going well. Unless you first delete an item somewhere in the middle and then try to move the one directly below it up. Then it will fail.

 

Who has a solution to this problem?

 

Thanks & greetings from the Netherlands!

 

Jorne

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @JvandeKraats :

I suggest you set the Trash icon's OnSelelct property to:

 

Set(TheOrder,ThisItem.Order); /*TheOrder is my custom variable*/
Remove(agenda,ThisItem);
UpdateIf(agenda,Order>=TheOrder,{Order:Order-1})

 

Doing so can ensure that the order of all items are continuous.

Best Regards,

Bof

View solution in original post

3 REPLIES 3
v-bofeng-msft
Community Support
Community Support

Hi @JvandeKraats :

I suggest you set the Trash icon's OnSelelct property to:

 

Set(TheOrder,ThisItem.Order); /*TheOrder is my custom variable*/
Remove(agenda,ThisItem);
UpdateIf(agenda,Order>=TheOrder,{Order:Order-1})

 

Doing so can ensure that the order of all items are continuous.

Best Regards,

Bof

View solution in original post

Dear Bof,

 

Thank you for the simple, but great solution for my problem.

Have a nice day!

 

Best regards,

 

Jorne

RTB_10
Helper I
Helper I

Found another solution which doesn't involve having to remove all the items when something is deleted. 

 

Because April's method depends on all the order numbers being in a sequential order it fails when items get deleted. However, on Shane's YouTube channel he has a video which shows how to update a column with new row numbers even when items are removed. See here: PowerApps Tracker App including Add row numbers to a gallery.

 

So to get this to work with April's method I just added a step to update the row numbers each time a selection is made. Now item's can get ordered and removed at the same time!

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,795)