cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Aurora
Helper V
Helper V

How to filter or sort a SharePoint gallery 3 ways on a button press

Hi all, 

 

I have an app with a gallery that shows data from a SharePoint list.  Users submit a form on one page to request an approval, and their submission can either be "Pending", "Approved", or "Rejected" on our SharePoint site. My Gallery page currently displays all the items on that SharePoint site, but I want to be able to have users sort the Gallery and only see items for the status they have chosen. I will include some pictures below of what I have, I'm thinking that 3 buttons would be fine (each button filtering by one status) but I haven't been able to get any buttons to filter the gallery. 

 

Any suggestions? 

Capture1.PNG

Capture.PNG

 

I've tried using a variable, but I'm not very experienced with them and unsure of what to try. I got this code error free: 

UpdateContext({var1:Filter(Aurora_Engineering_Standard_Components, Text(Approval_Status) ="Pending")})

but I'm not sure if it'll help do what I want. 

 

Thanks for any help!

 

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @Aurora ,

You need to set a Variable on each button OnSelect (example)

UpdateContext({varFilter:"Pending"})

and the Items of your Gallery

Filter(
   Aurora_Engineering_Standard_Components, 
   Approval_Status = varFilter
)

 

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.

Visit my blog Practical Power Apps

View solution in original post

4 REPLIES 4
WarrenBelz
Super User
Super User

Hi @Aurora ,

You need to set a Variable on each button OnSelect (example)

UpdateContext({varFilter:"Pending"})

and the Items of your Gallery

Filter(
   Aurora_Engineering_Standard_Components, 
   Approval_Status = varFilter
)

 

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.

Visit my blog Practical Power Apps

Aurora
Helper V
Helper V

@WarrenBelz 

 

I added buttons with the OnSelect properties set to your formula. Now that I've changed the Items property of my gallery, nothing is showing up. Not sure if I need to change one of the formulas, do you have any other suggestions? 

 

2Capture.PNG

 

3Capture.PNG

Thank you for the help.

Aurora
Helper V
Helper V

@WarrenBelz 

I'm not sure if it matters, but "Pending", "Approved", and "Rejected" are all choices from a SharePoint column, so I don't know if they are recognizable as text. 

Aurora
Helper V
Helper V

@WarrenBelz 

 

I set the formula to

Filter(Aurora_Engineering_Standard_Components_1,
Approval_Status.Value = varFilter
)

 

And it works now, thank you for the help!

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Solution Authors
Top Kudoed Authors
Users online (2,053)