cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

Filter Gallery using a Button with StartsWith function

I new to PowerApps and am still in the learning process. 🙂

I have a gallery pulling from the datasource "NetProject".

I would like to create a button that mimicks the alphabet so it only pull records that start with A-E, F-J, K-O, P-T, V-Z. ( I've created buttons for "A-E"  "F-J" "K-O" "P-T" and "V-Z")

When users click the button of choice, only those Organization names ("Organization" is my column name) that start with letters A-E, etc. only show up.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Filter Gallery using a Button with StartsWith function

Hi @ttaylor ,

 

The formulas should be:

Button1.OnSelect=Set(V1,"A");Set(V2,"B");Set(V3,"C");Set(V4,"D");Set(V5,"E")
Button2.OnSelect=Set(V1,"F");Set(V2,"G");Set(V3,"H");Set(V4,"I");Set(V5,"J")
...
Gallery1.Items=Filter( NetProject,StartsWith(Organization,V1)||StartsWith(Organization,V2)||StartsWith(Organization,V3)||StartsWith(Organization,V4)||StartsWith(Organization,V5))

Regards,

Mona

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

View solution in original post

4 REPLIES 4
Highlighted
Dual Super User
Dual Super User

Re: Filter Gallery using a Button with StartsWith function

Hi @ttaylor 

 

When ever user clicks on a button - set a variable

example - when button A is clicked

Set(varAlphabet,"A") 

 

 

then for your gallery control

for items property

Filter(datasorurce, StartsWith(column,varAlphabet))

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Highlighted
Community Support
Community Support

Re: Filter Gallery using a Button with StartsWith function

Hi @ttaylor ,

 

The formulas should be:

Button1.OnSelect=Set(V1,"A");Set(V2,"B");Set(V3,"C");Set(V4,"D");Set(V5,"E")
Button2.OnSelect=Set(V1,"F");Set(V2,"G");Set(V3,"H");Set(V4,"I");Set(V5,"J")
...
Gallery1.Items=Filter( NetProject,StartsWith(Organization,V1)||StartsWith(Organization,V2)||StartsWith(Organization,V3)||StartsWith(Organization,V4)||StartsWith(Organization,V5))

Regards,

Mona

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

View solution in original post

Highlighted
Helper III
Helper III

Re: Filter Gallery using a Button with StartsWith function

It worked! You rock!!!

 

The correct data displayed. I can then add a sort so the data appears alphabetically, correct? 

 

 
Highlighted
Dual Super User
Dual Super User

Re: Filter Gallery using a Button with StartsWith function

Hi @ttaylor 

 

To add the sort to this formula, you can update the expression as:
Sort(Filter( NetProject,StartsWith(Organization,V1)||StartsWith(Organization,V2)||StartsWith(Organization,V3)||StartsWith(Organization,V4)||StartsWith(Organization,V5)),Organization,Ascending)
 
This will filter the records and sort them in ascending order.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (9,619)