cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
sdaniel
Level: Powered On

Filter Gallery using multiple conditions

Hello All, I hoping some genius out there can help me. I am trying to use multiple dropdowns, a toggle and a checkbox to filter a SPO list using a gallery.

 

I have a two SPO lists. 1. Audits 2. Audit Tasks.

I created two Galleries: 1. Gallery_AllAudits 2. Gallery_Tasklist_1.

Gallery_Tasklist_1 filters from the SPO Audit Tasks based upon Gallery_AllAudit item selected. 

I have multiple dropdowns (above the Gallery_Tasklist_1) that I want to use to filter the Gallery_Tasklist_1 specific to the selected Audit. 

Dropdowns.png

I'm having several issues.

1. How can I filter the gallery based the dropdowns independtly, the way it's setup now, it doesn't filter the list.

Inp_AuditName_1 Default: Gallery_AllAudits.Selected.Audit_Name

2. How can I add a filter based upon a toggle (SPO yes/no field) nor the Checkbox (SPO yes/no field).

 

 

This is the syntax I current have for Gallery_TaskList_1:

 

Filter('Audit Tasks',If(IsBlank(Inp_AuditName_1.Text),true,Audit_Name=Inp_AuditName_1.Text)&&
If(IsBlank(Dropdown_Req.Selected.Result),true,Req_x002e__x0023_=Dropdown_Req.Selected.Result)&&
If(IsBlank(Dropdown_Ref.Selected.Result),true,Ref_x002e_ID=Dropdown_Ref.Selected.Result)&&
If(IsBlank(Dropdown_ARequest.Selected.Result),true,Comment=Dropdown_ARequest.Selected.Result)
||If(Dropdown_ARequest.Selected.Result="-",Comment<>(Dropdown_ARequest.Selected.Result),"")
)

1 REPLY 1
Super User
Super User

Re: Filter Gallery using multiple conditions

Hello!

 

Ok, so you want multiple options to filter by and for them all to be applied individually - there are two main ways to go about this:

As a starter, either:

1. Include an "ALL" item into your dropdowns by adding it as the first item when collecting the items, for example:

 

ClearCollect(
                     ProfitCentresSubList,
                     //Here we are adding a single record
                     //Whose value for all filterable columns is "ALL"
                     {
                          'Profit Centre Name': "ALL",
                           ClosedStatusText:"ALL",
                           ProfitCentre:"ALL",
                           ApprovalStatusText:"ALL"
                     },
                     SortByColumns(
                                                ProfitCentres,
                                                "ProfitCentreFullText",
                                                Ascending
                     )
);

or

 

2. Do multiple top-level 'If' statements (always top-level to prevent delegation issues) - I do not recommend this option, as you will have to provide an 'If' case for all possible options, which becmes hard to debug

 

So carrying on from Choice 1.

 

You would then set on the Gallery_Tasklist_1 Items = something like:

 

Filter(
          'Audit Tasks',
          (
          //Here they have selected All, so we are checking if they did and not filtering
          Inp_AuditName_1.Text = "ALL"
          //Otherwise, filter by what they chose
             ||
          Audit_Name = Inp_AuditName_1.Text
          )
          &&
          (
           Dropdown_Req.Selected.Result = "ALL"
              ||
           Req_x002e__x0023_= Dropdown_Req.Selected.Result
          )
          &&
          (
          Dropdown_Ref.Selected.Result = "ALL"
             ||
          Ref_x002e_ID = Dropdown_Ref.Selected.Result 
          )
          &&
          (
          Dropdown_ARequest.Selected.Result ="ALL"
             ||
          Comment = Dropdown_ARequest.Selected.Result
          )
&&
SPOtoggleColumnName = Toggle1
&&
SPOCheckBoxColumn = Checkbox1 )

 

 

The Toggle and Checkbox items act as boolean variables themselves, so you can filter by:

BooleanColumnName = ToggleName

or

BooleanColumnName = CheckboxName

 

 

Please give this a try and feel free to reply here if you have any questions, I'll try get back to you as soon as I can (but I also have my day-to-day work to attend to) 🙂

 

Cheers,

ManCat




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,535)