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 III
Super User III

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 III
Super User III

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

WarrenBelz
Super User III
Super User III

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_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,877)