cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Filtering Gallery via drop downs tied to variables

The gallery's data source is a SharePoint List. This app will allow my team to filter through servers to modify their patch status. I've set my variables for two of my drop downs withing the OnVisible of my main screen:

 

UpdateContext({varproblem:0});UpdateContext({varyes:0});UpdateContext({varno:1});UpdateContext({varanytime:1});UpdateContext({varafterhours:0});UpdateContext({varcritical:0})

 

There are 3 drop down boxes. The two I'm trying to get working are for patch status, and server classification. I was able to get the patch status filter to work by itself, but when I tried to mirror that logic by adding in the server classification variables to the formulas, I'm not able to get the filtering to work. The patch status dropdown, and filter still works even with the update if statements containing the new classification variables. 

 

I've set within the Items property of the dropdowns for patch status in the following format: 

 

["Anytime,"After Hours", "Critical", "All"]

 

I follow the same format for the other dropdowns as well. The OnSelect for my filter icon is configured as so: 

 

If(Dropdown3_1.Selected.Value = "Problem",UpdateContext({varproblem:1,varyes:0,varno:0}),
If(Dropdown3_1.Selected.Value = "Yes",UpdateContext({varyes:1,varno:0,varproblem:0}),
If(Dropdown3_1.Selected.Value = "No",UpdateContext({varno:1,varyes:0,varproblem:0}),
If(Dropdown4.Selected.Value = "Anytime",UpdateContext({varanytime:1,varafterhours:0,varcritical:0}),
If(Dropdown4.Selected.Value = "After Hours",UpdateContext({varafterhours:1,varanytime:0,varcritical:0}),
If(Dropdown4.Selected.Value = "Critical",UpdateContext({varcritical:1,varanytime:0,varafterhours:0})))))))

 

My Gallery Items propety is set as so:

 

If(varproblem=1,Filter('Server Patching - Master',Assign= CurrentUser.FullName,Patched="Problem"),
If(varyes=1,Filter('Server Patching - Master',Assign= CurrentUser.FullName,Patched="Yes"),
If(varno=1,Filter('Server Patching - Master',Assign= CurrentUser.FullName,Patched="No"),
If(varanytime=1,Filter('Server Patching - Master',Assign= CurrentUser.FullName,Classification="Anytime"),
If(varafterhours=1,Filter('Server Patching - Master',Assign=CurrentUser.FullName,Classification="After Hours"),
If(varcritical=1,Filter('Server Patching - Master',Assign=CurrentUser.FullName,Classification="Critical"),
Filter('Server Patching - Master',Assign=CurrentUser.FullName,Patched="No",Classification="Anytime")))))))

 

I believe my problem is in the syntax for the above Gallery's Items property, but since I'm pretty new to PowerApps I'm not sure of the proper syntax. Any help would be appreciated. Thank you. 

1 REPLY 1
Highlighted
Community Support
Community Support

Re: Filtering Gallery via drop downs tied to variables

I personally think the variables here may cause the problem.

If you would like to filter the table based on the Dropdown value, then you cuold just put the Dropdown.selected.value within the condition part of the filter() function.

For example:

Filter('Server Patching - Master', 
Assign= CurrentUser.FullName,
Patched=Dropdown3.selected.value,
Classification=Dropdown4.selected.value)

So the logic here would be if you would like to have the Dropdown.Selected Value to be filtered together.

For how to work with Filter function, see:

Filter, Search, and Lookup functions in PowerApps

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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