cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
pvanolinda
Advocate I
Advocate I

Filter SharePoint contacts list using letter buttons

I've created a PowerApp using a SharePoint contacts list as the data source. I'm trying to filter the list by either entering text into a text input field or by clicking a button that corresponds to a letter in the alphabet or a 'See All' button to toggle back to showing all entries. I can't figure out which formula to use in the 'OnSelect' property of each letter button, as well as the 'See All' button. Here's what I'm trying to create:

 

2019-02-18 18_25_09-Window.png

Any help would be greatly appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
Mickyw
Resolver I
Resolver I

Don't use OnSelect and buttons. Just use two galleries:

  • G1 - gallery with all the letters. You can just use list of strings as a Items property. Put label with Text set to This item.Value as the only control in this gallery.
  • G2 - gallery showing contacts. Modify its Items property to use Filter(<original Items>, Starts with(<searched column>, G1.Selected.Value). Add If at the top to accommodate search based on input box (I'm on mobile so I refrain from giving full example) - something like If(!IsBlank(Input.Text), Filter <by input>, Filter <by g1 selected>)

For "See All" button - you can also use G1 - but you would need to put empty string there and add logic to display "see all" if Value is blank - or - create a separate button and set additional contex variable (call it here: "display_all_contacts") onVisible to true. Then "See All" button would also reset it to "true" but OnSelect on G1 should set it to false. Then add another clause within If under Items of G2 to show entire contact list if "display_all_contacts" is true.

 

Mick

View solution in original post

2 REPLIES 2
Mickyw
Resolver I
Resolver I

Don't use OnSelect and buttons. Just use two galleries:

  • G1 - gallery with all the letters. You can just use list of strings as a Items property. Put label with Text set to This item.Value as the only control in this gallery.
  • G2 - gallery showing contacts. Modify its Items property to use Filter(<original Items>, Starts with(<searched column>, G1.Selected.Value). Add If at the top to accommodate search based on input box (I'm on mobile so I refrain from giving full example) - something like If(!IsBlank(Input.Text), Filter <by input>, Filter <by g1 selected>)

For "See All" button - you can also use G1 - but you would need to put empty string there and add logic to display "see all" if Value is blank - or - create a separate button and set additional contex variable (call it here: "display_all_contacts") onVisible to true. Then "See All" button would also reset it to "true" but OnSelect on G1 should set it to false. Then add another clause within If under Items of G2 to show entire contact list if "display_all_contacts" is true.

 

Mick

View solution in original post

Thanks for the suggestion. I'll give that a try!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (60,738)