cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Serviced2000
Helper III
Helper III

Gallery Not Refreshed After Patch

Hi There,

 

I have been trying to get a small gallery for 'Note's to refresh after the Notes table has been patched. When you first open the screen, the gallery is populated with the 'notesCollection' created by this formula : 

 

ClearCollect(notesCollection, SortByColumns(Gallery2.Selected.Notes, "createdon", Descending));

 

This results in a nicely formatted Gallery like this : 

 

Serviced2000_0-1629872413155.png

When I add a new Note the 'Save' button formula  looks like this :

 

Patch(Notes, Defaults(Notes), {Title:txtAmendmentNoteSubject.Text}, {Description:txtAmendmentNoteBody.Text}, {'Regarding (_objectid_value)': SelectedPlacement}, {isdocument:false});ClearCollect(notesCollection, SortByColumns(SelectedPlacement.Notes, "createdon", Descending));UpdateContext({showAmendmentNoteDialog:false})

 

I've highlighted the ClearCollect command because that's what I've found in multiple places while researching the problem, but the gallery now looks like this : 

Serviced2000_1-1629872527502.png

I can see that the gallery has been refreshed, the data is added to the Notes table and the data has been pulled into the collection (that's the highlighted one) but all the other label text is now missing. 

 

If I go back to the main screen and re-select the item, the Gallery looks great again.

 

There must be something obvious I'm missing, but can anyone help point this out?

 

Thanks!

 

 

6 REPLIES 6
KvB1
Solution Specialist
Solution Specialist

In your highlighted clearcollect, what is SelectedPlacement?

CNT
Super User
Super User

@Serviced2000 If you don't need the collection for other purposes, it would be better to avoid it and set the Items property of the Gallery to, SortByColumns(Gallery2.Selected.Notes, "createdon", Descending)

Hi @KvB1 ,

 

SelectedPlacement is a record / item passed as a variable from "Gallery2" on the main page of this app.

Thanks @CNT ,

 

I'm pretty sure that's what I did to begin with and then I had to change it to a collection (but I can't remember why). I'll give this another go...

Serviced2000
Helper III
Helper III

Hi @CNT ,

 

I made this change and it displays well, but when I Patch the notes table the gallery doesn't refresh on screen. I'll go do some digging but if you know of a way I can trigger this, that would be valuable.

 

Thanks!

Hi @Serviced2000 ,

 

After the notes Patch and before the ClearCollect would you try adding Refresh(Notes) and check if gallery data is updating ?

 

If this post was helpful or you need more help please consider giving Thumbs Up and Tag me in your reply I'll be happy to help. If this post helped you solve your issue please click Accept as solution and provide Thumbs Up. This will help others find it more readily.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,852)