Skip to main content

Notifications

Community site session details
Power Apps - Building Power Apps
Answered

How to refresh gallery in real time

Like (0) ShareShare
ReportReport
Posted on 2 Aug 2021 06:22:46 by 290

Hey! I am working on Time off app. I have this issue, hope someone can help.

 

If an employee asks for a vacation, it saves the info in the sharepoint list and it shows in my gallery. The thing is that the gallery is not refresing in real time, meaning I have to refresh the whole app to see the request. Could someone help?

 

The gallery:gallery.PNG

 

And the sharepoint list:

data.PNG

 

  • Filistyn Profile Picture
    290 on 03 Aug 2021 at 05:58:24
    Re: How to refresh gallery in real time

    I suppose I am playin the app. I just start up Powerapps and turn the app on.

     

    Yes, my friend is on different PC and rn we can't really test out, if things refresh for him, cuz he is a regular user so he has limited possibilities in the app.

     

    I though about refresh button as the last option, but I think I had to add it, cuz there is no effective solution I suppose.

     

    Gonna try few things and come back with the results.

  • WarrenBelz Profile Picture
    146,743 Most Valuable Professional on 02 Aug 2021 at 10:02:11
    Re: How to refresh gallery in real time

    @Filistyn ,

    A few questions

    • Are you in "Play" mode from the Design function or actually playing the app - If in the first, things do not always refresh as expected.
    • Is your friend on another PC - if so does it refresh when you change something yourself actually playing the app?
    • If you go out of the screen and back in again, does it refresh after a change?

    You can also add a refresh button Refresh(ListName) - I have to do this at times when the filter is a bit complex.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Filistyn Profile Picture
    290 on 02 Aug 2021 at 09:19:25
    Re: How to refresh gallery in real time

    Hello! Thank you for your tip.

     

    I have tried to put this code into the Gallery 

    With(
     {
     wList:
     Sort(
     VacationTracker; 
     ID;
     Descending
     )
     };
     SortByColumns(
     Filter(
     wList; 
     DepartmentCopy = lblDepartment.Text; 
     Title <> User().Email
     ); 
     "Approval"; 
     Descending
     )
    )

     

    My friend asked for a Vacation while i had the gallery open and still nothing have popped up. I had to refresh the app 😞

  • Verified answer
    WarrenBelz Profile Picture
    146,743 Most Valuable Professional on 02 Aug 2021 at 07:54:51
    Re: How to refresh gallery in real time

    Hi @Filistyn ,

    Firstly, the issue is not obvious presently as the gallery Items

    SortByColumns(
     Filter(
     VacationTracker; 
     DepartmentCopy = lblDepartment.Text; 
     Title <> User().Email
     ); 
     "Approval"; 
     SortOrder.Descending
    )

    are directly querying the list and should refresh. One issue here is that the <> operator is not Delegable, so you could try this

    With(
     {
     wList:
     Sort(
     VacationTracker; 
     ID;
     Descending
     )
     };
     SortByColumns(
     Filter(
     wList; 
     DepartmentCopy = lblDepartment.Text; 
     Title <> User().Email
     ); 
     "Approval"; 
     Descending
     )
    )

    The Patch code should work although I tend to be record specific

    Patch(
     VacationTracker; 
     {ID:ThisItem.ID}; 
     {Approval:"Accepted"}
    );;

    The Date should refresh as long as the gallery contains the current record details

    If(
     ThisItem.TypeOfVacation = "Vacation" ||
     ThisItem.TypeOfVacation = "Business Trip"; 
     ThisItem.StartDate & " to " & ThisItem.EndDate; 
     ThisItem.TypeOfVacation = "Overtime" || ThisItem.TypeOfVacation = "Halfday"; 
     ThisItem.StartDate
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Filistyn Profile Picture
    290 on 02 Aug 2021 at 06:45:23
    Re: How to refresh gallery in real time

    For the whole gallery its: 

    SortByColumns(Filter(VacationTracker; DepartmentCopy = lblDepartment.Text; Title <> User().Email); "Approval"; SortOrder.Descending)

    Most of the items are just ThisItem.SharePointData.

    If you press the button it's 

    Patch(VacationTracker; ThisItem; {Approval:"Accepted"});;

    same goes for the decline button.

     

    The code, that show the date is 

    If(ThisItem.TypeOfVacation = "Vacation" || ThisItem.TypeOfVacation = "Business Trip"; ThisItem.StartDate & " to " & ThisItem.EndDate; ThisItem.TypeOfVacation = "Overtime" || ThisItem.TypeOfVacation = "Halfday"; ThisItem.StartDate)

     

    Here it just depends on what type of Time off you want to take

  • WarrenBelz Profile Picture
    146,743 Most Valuable Professional on 02 Aug 2021 at 06:40:21
    Re: How to refresh gallery in real time

    @Filistyn ,

    What are the Items of the gallery and what is the OnSelect of the Accept and Decline buttons?

    Please supply in Text.

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,743 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,079 Most Valuable Professional

Leaderboard
Loading started
Loading started