cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Greg27
Super User
Super User

Updating a Gallery generates error

I have a button that changes the filter on a gallery. My button starts with "Gallery1.Items=Filter(" however, I have a red line under Items and it says "Name isn't valid. This identifier isn't recognized".

1 ACCEPTED SOLUTION

Accepted Solutions
MatthiasL
Advocate IV
Advocate IV

You can't manipulate values directly.
One option would be to set a variable:

 

[myButton.onSelect]
Set(varFilter, 1)

 

 

Depending on the value of this variable you can now change your filter in the gallery:

 

[myGallery.Items]
Switch(varFilter,
       1, Filter([your filter statements]),
       2, Filter([your other filter statements]))

 

 

That's maybe not the most elegant way to do this but it demonstrates the functionality.

View solution in original post

4 REPLIES 4
MatthiasL
Advocate IV
Advocate IV

You can't manipulate values directly.
One option would be to set a variable:

 

[myButton.onSelect]
Set(varFilter, 1)

 

 

Depending on the value of this variable you can now change your filter in the gallery:

 

[myGallery.Items]
Switch(varFilter,
       1, Filter([your filter statements]),
       2, Filter([your other filter statements]))

 

 

That's maybe not the most elegant way to do this but it demonstrates the functionality.

Ashish-_-
Frequent Visitor

Hi ,

By introducing a variable in the  formula of the control's property, you can dynamically modify properties using other controls. But what you are trying to do is not possible , as the properties can't be manipulated in this fashion.

 

Button   [OnSelect] => {Change variable x }
  
Gallery   [Items] => {Filter(Source, include x in expression accordingly) }

Thanks @MatthiasL !!

Thanks @Ashish-_- !!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

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

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,892)