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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patching gallery from ...
Power Apps
Suggested Answer

Patching gallery from Sharepoint List resort automatically, I need a workaround

(1) ShareShare
ReportReport
Posted on by 179
Hello everyone!
 
I have in front of an enigma I have a hard time to solve. I load a Sharepoint List into a gallery and I need to sort it in ascending order for a specific column. So far so good, it works.

Now, I gave the user a button to change the sum of a specific row if he needs to (it's actually a +4, the action look at the current number, adds 4 to it and patch it directly into the Sharepoint List).
 
The problem is this : the list refreshes after the patch is done and doing so re-sort the list. It screws up the way they need to work because they want to go through the list from lowest number to highest and adjust with the increment button based on if they need it or not. There should be no re-sort.
 
I do not know how to work around this. I tried to load the Sharepoint List into a variable. Now I have the original value and I could sort by this one instead but I do not know how to put it in the original Gallery (or vice-versa).



So.. I see 2 ideas that could help but I don't know how to do them. I'm open to other ideas as well :

1) make that gallery sort itself ONLY when a button is pressed
2) load a copy of the original data in a variable, use it to sort the gallery
Categories:
  • Suggested answer
    RyanAutomates Profile Picture
    141 on at
    Hi there,
     
    I think I'm missing something here, from your explanation and your image, I'm thinking that your +4h button will add 4hrs to the hours column, and from your explanation, the users want to go from the lowest number to the highest number, but the list doesn't look like it's sorted by lowest hours at the top.....
    I would also ask, why wouldn't you want the list to re-sort itself, i.e. move the higher numbers down the list, this puts the lower numbers requiring actioning at the top of the list for users to see?
     
    Perhaps a simpler solution could be this if the UI is acceptable to your users:
    Rather than patching each row immediately when a user hits your +4 button, could you add a "submit" button, to patch in all changes to rows where +4 has been clicked when the user is done editing? This way the gallery would refresh at the end only.
     
    Hope this helps! :)
  • Volt26 Profile Picture
    179 on at
    Hello RyanAutomates,
     
    the screenshot doesn't show to sorted data because I was testing something that broke that part.. Here is the properly working screenshot with sorting on :
     
     
    The reason why a submit button won't do it is because we want the data permanently recorded as soon as the action is done. That way, if the browser crashes/closes, nothing will be lost and the user will be able to start from where he was.
     
    Automatically sorting after a patch is a pain because the user needs to do the button action once per line. If he adds 4h to "Captain America", that line will go down after "Iron Man". So the user will probably do mistakes such as clicking the button again, over and over.


    If I could have a column that shows the real data from the sharepoint list and sort by another column that would be a copy of the original data, then I would sort by it. The user would see his action added 4h to the real data and sees what it was before he did the action. There must be a way to do this, right?
  • Suggested answer
    Volt26 Profile Picture
    179 on at
    Well it seems I found a way to stick to the need of the user :
     
    I load the Sharepoint List into a variable. The gallery shows that variable. And when the +4h button is pressed, this code runs :
     
    Patch(
        ListeTempsSupplémentaire;
        LookUp(
            ListeTempsSupplémentaire;
            Titre=ThisItem.Titre
        );
        {SommeTS: ThisItem.SommeTS + 4}
    )
     
    To allow user to visualize if there the new sum is there, I display the column with the original SommeTS and a column that fetches the value from the Sharepoint List :
    LookUp(ListeTempsSupplémentaire;Titre=ThisItem.Titre;SommeTS)


    There is probably a better way to do this but I'm far from a real programmer so.. That will do for now :)
    I'm open to suggestions!
  • Suggested answer
    RyanAutomates Profile Picture
    141 on at
    Hi Volt26,
     
    If that works for you, then great! I though that route might be a bit of hassle programming wise.
     
    If it's a visual prompt you need to prevent the user from clicking the same row again, then perhaps this might enhance it also:
     
    You could always also add a timer say a 10 second countdown that starts when a user clicks a button and on that timer start, disable the button (make it change colour and go grey perhaps (or make the whole row go grey for a little bit!)), then on timer end, make it editable again to prevent them double clicking ;)
     
    Maybe you could add a modified on date or time to show when it was last edited also?
     
     
    Hope this helps! :)
     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 337 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 250

#3
Mohsin Ali Profile Picture

Mohsin Ali 225

Last 30 days Overall leaderboard