cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Oskarkuus
Post Prodigy
Post Prodigy

Refresh/Update gallery data after patch

I have a gallery called Gallery1.

 

I have a button in the gallery on each "row" called Button11

 

When i press button 11 i run this.

Patch(InventeringMain;ThisItem;{Inventeringsdatum:Now()})

 

my datasource is a sharepointlist.

 

The data is updated in the column.

But the gallery is not updating.

 

The gallerys ITEM function is set to a variable "varInventeringFilter"

The variable is set on a button
"Set(varInventeringFilter;Filter(InventeringMain;TextInput2.Text in Rubrik Or TextInput2.Text in Enhetsnamn Or TextInput2.Text in Kategori Or TextInput2.Text in Geografiskplats Or TextInput2.Text in Inventeringsdatum))"

But for some reason the gallery is not refreshing and showing the patched data.

I have tried

referesh(datasoruce)

 

i have tried to use

select(button) - the button that SET the variable. But this resorts the gallery so i do not want to use this one. I just want to UPDATE the just patched data so it can be seen in the gallery.

7 REPLIES 7
eka24
Super User
Super User

Please have you confirmed in your sharepoint list that the data is really patched. If so, then Refresh(Datasource) should work. I also hope the gallery is linked to the sharepoint list itself and not a collection.

If you like this post, give a thumbs up. Where it solved your issue, Mark as a solution

Yes the data is really patched in the datasource

Patch(InventeringMain;ThisItem;{Inventeringsdatum:Now()}) ;; Refresh(InventeringMain)

Refresh(datasource) does not work, nothing happens.

Only way to get the new updates is to either restart the app or to press a button where i have the filter SET function

But pressing that button will resort the list and that does not work!

Hi @Oskarkuus ,

There will be a solution to this, however firstly the gallery will not refresh (even if the data set is) if it is set to a Variable that still contains the data from the last time it was set.

I am wondering why your gallery Items is simply not

Filter(
   InventeringMain;
   TextInput2.Text in Rubrik || 
   TextInput2.Text in Enhetsnamn ||
   TextInput2.Text in Kategori ||
   TextInput2.Text in Geografiskplats ||
   TextInput2.Text in Inventeringsdatum
)

as the In filter must not be causing you delegation issues.
You could still set the variable as you do now if you use it for other things and the gallery would refresh when this is done to the data source.

 

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.

Well i do not want the gallery to filter when user types in textinput. I want the filter to run when clicking a search button.
Thats why i set the variable to filter.

Hi @Oskarkuus ,

This is a bit of a circular issue. If you set the gallery to a variable that is not refreshed, then the gallery cannot refresh.

I will ask another question - you are using the In filter - are you looking for an exact match or is the user's text at the start of the field.

If either are the case, if you set the Default of all the search fields to "" (empty string, not Blank), you can use

Set(
   varInventeringFilter;
   Filter(
      InventeringMain;
      StartsWith(Rubrik, TextInput2.Text);
      StartsWith(Enhetsnamn, TextInput2.Text);
      StartsWith(Kategori, TextInput2.Text);
      StartsWith(Geografiskplats, TextInput2.Text);
      StartsWith(Inventeringsdatum, TextInput2.Text)
   )
)

and run this after the Patch and data source refresh. The full refreshed list will display until the user inputs some text in one of the boxes.

 

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.

unislacker
Helper II
Helper II

had same issue and had to make sure my SharePoint list was a single line of text and that i was converting Now() into a text 

 

see below 

 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-text

AaronO
Helper II
Helper II

The problem you have is that the gallery is set to a variable which is never updated.   Your source data is updated, but the variable contains a separate copy of the information which needs to be refreshed.  You can either issue the Set() command again every time the source data is updated, or you can modify your Gallery1 Items to refer to the source data directly instead of using the variable.  Basically just place  "Filter(InventeringMain;TextInput2.Text in Rubrik Or TextInput2.Text in Enhetsnamn Or TextInput2.Text in Kategori Or TextInput2.Text in Geografiskplats Or TextInput2.Text in Inventeringsdatum)" in the Items property. Directly referring to the source data has performance implications, but it is also the least maintenance way to keep the list updated.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (3,529)