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 / Populating gallery on ...
Power Apps
Answered

Populating gallery on form load shows items from previous selected Sharepoint item

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have two lists that are linked via ID. The first list (let's call it "box") can have several items from the second list (let's call them "cubes"). All of the cubes that should be in the box are display in a gallery next to the form.

When I open up the first box after loading the page I get the right cubes that are linked to the box. When I close the box and open up another I get all the cubes from the previous box in my gallery.

I use the following code in OnVisible on the screen:

ClearCollect(BoxCollection; Filter(Cubes; BoxID= SharePointIntegration.Selected.ID));;

 

And the BoxCollection is used as a data source in the gallery.

Is there any way to make sure that the proper items are loaded? If I select the items twice I get the proper result. It's just like it gets cached somewhere and it gets immediately loaded once you select the item.

 

Any help would be much appreciated.

 

 

Categories:
  • WarrenBelz Profile Picture
    156,921 Most Valuable Professional on at

    Hi @Anonymous ,

    SharePoint integration refreshing on relational queries in not the best unless you refresh the SharePoint list before opening the power app again on the same screen. I get exactly the same thing on galleries from other lists if the gallery is on the initial screen opened. My users simply refresh SharePoint before opening the next one, but you can also look at putting the gallery on a different screen and then it generally refreshes when navigating to it.

     

    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.

    Visit my blog Practical Power Apps

  • WarrenBelz Profile Picture
    156,921 Most Valuable Professional on at

    Hi @Anonymous ,

    Just checking if you got the result you were looking for on this thread. Happy to help further if not.

    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.

    Visit my blog Practical Power Apps

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    The way it's setup currently I'd need to refresh the collection when opening each item or at least clear them out. I've tried clearing the collection on the OnHidden event, but it didn't work.

  • WarrenBelz Profile Picture
    156,921 Most Valuable Professional on at

    @Anonymous ,

    Correct - that has been my experience also. A Canvas App takes away all of these issues and I generally tend to use them if the task is beyond simple New/View/Edit function on a List item. As I mentioned, I have a few with "child" galleries of related items and my users simply refresh the SharePoint list if they need to change records.

     

    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.

    Visit my blog Practical Power Apps

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Found the solution. I've cleared the collections on the OnHidden event, so that I don't have anything cached.

    And then I've added a timer for 500ms that at the end populates the collections. It adds a slight delay to the records loading but it always has the correct data.

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 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard