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 / Update gallery items
Power Apps
Answered

Update gallery items

(0) ShareShare
ReportReport
Posted on by 20

Dear powerapps community,

 

I'm using a gallery which datasource is a selected item of another gallery in another screen.

Let's say something like this for the datasource of gallery2: Gallery1.Selected.Relations

 

In my gallery2 (on another screen), I have a button to "Relate" a new Relation to the one Selected on Gallery1.

Update to the dataverse is ok. When I click my button, the relation is persisted to dataverse.

But my Gallery2 is not updated visually. When A change screen and reselect my gallery1, the items of gallery2 are well updated.

 

But if I stay on screen2, I can't find a way to refresh gallery2.

I tried a lot of methods found on internet, included this forum, but nothing works.
I think there is 2 issues.

- I do not use a dataverse as source, so I cannot refresh the source.

- I use a source on another screen, so, I cannot "select" again the gallery1 to be able to refresh gallery2.


Do you have any clue please ?

Regards 

Categories:
I have the same question (0)
  • Verified answer
    AhmedSalih Profile Picture
    6,680 Moderator on at

    Hello, @r_ramillien , Referencing controls across screens is not recommended and your issue is one of those reasons. try to use a Global variable, something like Set(glbGallerySelection, Gallery1.Selected.Relations), and then use this variable with your Gallery2. Something that happened to me before is the update using the global variable won't work as expected when I am updating data in Screen2, as per your example, so I created a Local variable to hold the value of the global variable in the Screen2 OnVisible property, something like UpdateContext({lclGalery1Selection: glbGallerySelection}).

     

    Let me know if that will work for you.

     

    Regards,

    Ahmed

    If my reply helped you, please give a 👍. And if it has solved your issue, please consider a 👍 & Accepting it as the Solution to help other members of the community find it more.

    My Blog: www.powerplatformplace.com

  • r_ramillien Profile Picture
    20 on at

    Hello Ahmed,

    Thank you, it works great ! 🙂

     

    I didn't make it work with global variable, so I used a local variable directly.

     

    When I click on gallery on first screen, I pass the "Relations" as local variable to the second screen:

    Navigate(Screen2, None, {relations: Gallery1.Selected.Relations'}).

    Then, in second screen, I set "relations" as "items" on "gallery2".

     

    And when I add an new item to DB, I simply:
    Relate(Gallery1.Selected.relations; ComboBox.Selected);;
    UpdateContext({relations: Gallery1.Selected.Relations})

     

    It wasn't easy to find, but thank you ! Hope it helps someone else now 🙂

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

#2
11manish Profile Picture

11manish 224

#3
Valantis Profile Picture

Valantis 181

Last 30 days Overall leaderboard