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

Filter Gallery using a Button with StartsWith function

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

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

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.
4 REPLIES 4
Super User
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

Community Support Team
Community Support Team

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.
ttaylor
Level: Powered On

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? 

 

 
Super User
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
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 191 members 4,251 guests
Please welcome our newest community members: