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

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
Community Support Team
Community Support Team

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
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 111 members 5,188 guests
Please welcome our newest community members: