cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Susi
New Member

How to filter a gallery based on more than one condition in Items property

I have a need to filter a gallery based on multiple conditions in the Items property.

 

1. filter based on text entered in search field:

Filter(GroupBy(colSPList, "Title", "Status"), Search.Text in Title)

 

colSPList is a collection based SharePoint list because the delegation errors get getting in the way.

"Status" is a single-select dropdown in SharePoint.

"Search" is a Text Input search field on the screen.

 

2. Additionally, I need to filter the gallery items for any items that do not have Status = Do Not Use. 

Filter(colSPList, Not("Suspended" in ThisRecord.Status.Value))

 

Individually, each of these Filter statemtnMy challenge seems to be to combine both filter statements into one. Somehow I keep getting error messages regardless of how I try to put this together. 

I also tried to have the Status as a text field in the gallery and filter based on that. No luck so far but I would be happy to reconsider that, too.

Any input would be greatly appreciated. Thanks!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @Susi ,

Try this for a start

Filter(
   GroupBy(
      AddColumns(
         colSPList, 
         "StatValue",
         Status.Value
      ),
      "Title", 
      "StatValue",
      "Data"
   ), 
   (IsBlank(SearchSearch.Text) || SearchSearch.Text in Title) &&
   StatValue <> "Suspended"
)

 

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.

View solution in original post

3 REPLIES 3
WarrenBelz
Super User
Super User

Hi @Susi ,

Try this for a start

Filter(
   GroupBy(
      AddColumns(
         colSPList, 
         "StatValue",
         Status.Value
      ),
      "Title", 
      "StatValue",
      "Data"
   ), 
   (IsBlank(SearchSearch.Text) || SearchSearch.Text in Title) &&
   StatValue <> "Suspended"
)

 

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.

WarrenBelz
Super User
Super User

Hi @Susi ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

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.

@WarrenBelz , thank you!! Your solution is amazing. (Sorry that it took me some time to respond, I had to shift gears on my end for a couple of weeks.)

 

There was just one thing that I needed to change. The SPList could have two entries with the same title. That means that I cannot compare text and table, I think. 

StatValue <> "Suspended"

threw an error and this piece had to be changed to 

Not("Suspended" in StatValue.StatValue)

to work.

That resulted in the following:

Filter(
   GroupBy(
      AddColumns(
         colSPList, 
         "StatValue",
         Status.Value
      ),
      "Title", 
      "StatValue"
   ), 
   (IsBlank(SearchSearch.Text) || SearchSearch.Text in Title) &&
   Not("Suspended" in StatValue.StatValue)
)

 

This seems to work fine from what I can tell.

 

Helpful resources

Announcements
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 (2,227)