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
Solved! Go to Solution.
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
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
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 🙂
User | Count |
---|---|
252 | |
102 | |
94 | |
50 | |
37 |