web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Moving Gallery Items o...
Power Apps
Answered

Moving Gallery Items only works if ID is greater

(0) ShareShare
ReportReport
Posted on by 21

Hi all!

I have a gallery that I have added up and down arrows to to facilitate shifting the order. The gallery is a collection from a Sharepoint list. On the up arrow's OnSelect I have: 

Select(Parent);Set(previousRecord,LookUp(KeyAreaOrder,Order=ThisItem.Order-1));Set(currentRecord,LookUp(KeyAreaOrder,Order=ThisItem.Order));Patch(KeyAreaOrder,ThisItem,{Order:previousRecord.Order});Patch(KeyAreaOrder,LookUp(KeyAreaOrder,Order=currentRecord.Order),{Order:previousRecord.Order+1});Set(previousRecord,Blank());Set(currentRecord,Blank())

 The first number column is the 'Order' column and the second is the ID

dfarrar_0-1626741985003.png

It works if the ID of the selected item is greater than the one above it, but not if the ID is less than.

Any ideas?

Thanks!

Categories:
I have the same question (0)
  • Verified answer
    StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @dfarrar 

     

    ItemOrder = Order Column in my SP list

     

    Select(Parent);
    Set(
     currentRecord,
     LookUp(
     'Key Aisle',
     ItemOrder = ThisItem.ItemOrder
     )
    );
    Set(
     CurrentItemOrder,
     currentRecord.ItemOrder
    );
    If(
     CurrentItemOrder > 1,
    
     Set(PreviousId, LookUp(
     'Key Aisle',
     ItemOrder = currentRecord.ItemOrder - 1
     ).ID);
     Patch(
     'Key Aisle',
     ThisItem,
     {ItemOrder: currentRecord.ItemOrder - 1}
     );
     Patch(
     'Key Aisle',
     LookUp(
     'Key Aisle',
     ID = PreviousId
     ),
     {ItemOrder: currentRecord.ItemOrder}
     );
     
    );
    Set(
     currentRecord,
     Blank()
    )

     

     

    Sample

    StalinPonnusamy_0-1626758200807.png

     

    If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

  • dfarrar Profile Picture
    21 on at

    Hi @StalinPonnusamy 

    That has worked, but I also want to change the order number for the record above so that I don't end up with multiple records with the same order number.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard