Showing results for 
Search instead for 
Did you mean: 
New Member

Filter a Gallery using buttons

Hi i have this gallery in my app browsegallery1 with this on Items = SortByColumns(Search([@POOL], TextSearchBox1.Text, "MATERIAL","NOMENCLATURA","NUMERO"), "MATERIAL", If(SortDescending1, Descending, Ascending))


In other Screen i have two buttons, i want to filter the gallery with the column "MATERIAL", i have two options there "CEMENT" and "pouzzolane"


i have this code in the buttons but it doesn't do anything

 UpdateContext({ds: Filter(POOL,MATERIAL="PUZO")});Navigate(BrowseGallery1,ScreenTransition.None)


thanks in advance

Super User
Super User


UpdateContext() only works on the same screen.  You need to use a global variable if your variable is on another screen: Set(ds, Filter(POOL,MATERIAL="PUZO")) should do the trick.

Not applicable

Like Drrickryp said, updatecontext is a local variable compared to a global from Set(). If you are working with both, be sure to label the variables as such. I had a big issue with accidentally using a local variable that had the same name as a global variable. Or the other way around, I completely overhauled the code instead of trying to find where the wires got crossed. For globals I use either varTest or glblTest and for locals I use lclTest or locTest. Whatever you use, be consistent and do not change all willy nilly or it just creates more headaches.

New Member

Thanks for the help, it didn't Filter the gallery 

Helpful resources

Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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