cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Doddy83
Helper IV
Helper IV

Filter Gallery on multiple dropdowns and text input

Hello, 

I've built a simple test app for logging incidents and need to add a filtering option on the Gallery (galIncidents).

 

I have two combo boxes (ddAssignedToo & ddStatus) to search the columns with the same name.

I have one Text Input (inpIncSearchBox) for searching the DescriptionOfProblem Column.

 

Items for ddStatus:

["","Open","Completed","Cancelled","Rejected","Amendments Required","Initial Approval Complete","Approved","Pending Approval","In Progress", "On Hold"]

 

Items for ddAssignedToo:

["","DisplayName1","DisplayName2"]

 

I'm looking for all records to be displayed unless one or more of the above combo boxes or the text input is filled in.

 

I hope this makes sense and any help would be much appreciated

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@Doddy83 

Consider the following formula for the Items property of your Gallery:

Search(
    Filter(yourDataSource,
        (IsBlank(ddStatus.Selected.Value) || Status = ddStatus.Selected.Value) &&
        (IsBlank(ddAssignedToo.Selected.Value) || AssignedToo = ddAssignedToo.Selected.Value)
    ),
    inpIncSearchBox.Text, DescriptionOfProblem
)

That's the basic structure. 

Now...I am guessing that Status is a choice column and AssignedTo is a Person column.  If so, then the following:

Search(
    Filter(yourDataSource,
        (IsBlank(ddStatus.Selected.Value) || Status.Value = ddStatus.Selected.Value) &&
        (IsBlank(ddAssignedToo.Selected.Value) || AssignedToo.DisplayName = ddAssignedToo.Selected.Value)
    ),
    inpIncSearchBox.Text, DescriptionOfProblem
)

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

7 REPLIES 7
Doddy83
Helper IV
Helper IV

Also this list is not delegated, it will always have less than 2000 records, not sure if this is relevant or not at this point...

RandyHayes
Super User
Super User

@Doddy83 

Consider the following formula for the Items property of your Gallery:

Search(
    Filter(yourDataSource,
        (IsBlank(ddStatus.Selected.Value) || Status = ddStatus.Selected.Value) &&
        (IsBlank(ddAssignedToo.Selected.Value) || AssignedToo = ddAssignedToo.Selected.Value)
    ),
    inpIncSearchBox.Text, DescriptionOfProblem
)

That's the basic structure. 

Now...I am guessing that Status is a choice column and AssignedTo is a Person column.  If so, then the following:

Search(
    Filter(yourDataSource,
        (IsBlank(ddStatus.Selected.Value) || Status.Value = ddStatus.Selected.Value) &&
        (IsBlank(ddAssignedToo.Selected.Value) || AssignedToo.DisplayName = ddAssignedToo.Selected.Value)
    ),
    inpIncSearchBox.Text, DescriptionOfProblem
)

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Many thanks for taking the time to reply @RandyHayes

I've tested this and the Text Input works a treat but I still cant get the dropdowns to work, it doesn't error but just brings back a blank list when I select anything in either dropdown? I've confirmed that the Combo box selections do match what's in each list column. Would it be anything to do with them being Combo boxes and not Dropdowns? I know I've called them ddAssignedToo & ddStatus but they are Combo boxes, NOT dropdowns.

Search(
    Filter(IncidentRequestList,
        (IsBlank(ddStatus.Selected.Value) || Status.Value = ddStatus.Selected.Value) &&
        (IsBlank(ddAssignedToo.Selected.Value) || AssignedTo.DisplayName = ddAssignedToo.Selected.Value)
    ),
    inpIncSearchBox.Text, "ShortTitle"
)

 

Converted to DropDowns and its now all working a treat, thank you so much again!

Doddy83
Helper IV
Helper IV

Another cheeky question if possible? How would I go about making it display everything except 'Completed' items if the dropdown and search box are empty?

RandyHayes
Super User
Super User

@Doddy83 

You can incorporate pretty much anything you want into the criteria of the filter.

I believe you might be looking for this:

Search(
    Filter(IncidentRequestList,
        (IsBlank(ddStatus.Selected.Value) || Status.Value = ddStatus.Selected.Value) &&
        (IsBlank(ddAssignedToo.Selected.Value) || AssignedTo.DisplayName = ddAssignedToo.Selected.Value) &&
        (IsBlank(ddStatus.Selected.Value) && 
         IsBlank(ddAssignedToo.Selected.Value) && 
         IsBlank(inpIncSearchBox.Text) && 
         !(Status.Value = "Completed")
        )
    ),
    inpIncSearchBox.Text, "ShortTitle"
)

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

I cant get that to work as is, but I will certainly have a play with the formula, many thanks again for your time on this one, it really is much appreciated when people like yourself take the time to help us lesser knowledgeable souls to enjoy tinkering with PowerApps without having to spend the time on it I'm sure you have over the years to become an expert!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,090)