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

Filter drop down based on a selected value

Good day.

 

I am in need of some assisstance. Consider the following scenario.

 

I have a screen1 with 2 buttons, (ButtonA, ButtonB).

I also have a 2nd screen, screen2 which has a dropdown box.

Based on what button is selected on screen1, The dropdown on screen2 should show corresponding data.

 

ButtonA - select fruit     (Should return a list of fruit)

ButtonB - select vegatable     (Should return a list of vegtables)

 

The data for fruit and vegtables are stored in the same table in a sharepoint lookup.

 

Any advice on how to filter the dropdown based on which button is clicked?

 

Thanks.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Mogammad
Level: Powered On

Re: Filter drop down based on a selected value

@RandyHayes 

Thank you for the solution.

 

I tried using a local variable before with the " UpdateContext({ VariableName: Value1}) " function, not understanding that the local variable cant be called on multiple screens.

 

Thanks.

View solution in original post

2 REPLIES 2
Super User
Super User

Re: Filter drop down based on a selected value

@Mogammad 

You could make use of a variable to achieve this.  So for example, on your buttons you would have something like this:

 

ButtonA - OnSelect :  Set(listFilter, "fruit")

ButtonB - OnSelect:   Set(listFilter, "vegetable")

 

Then on your screen 2 dropdown, set the Items property to something like the following formula:

Filter(sharePointList, yourColumn = listFilter)

 

Now you kind of mentioned in your posting that "The data for fruit and vegetables are stored in the same table in a sharepoint lookup."  Does this imply that the column you are looking at in your SharePoint list is a Lookup type column?  If so, then adjust the formula above to the following:

Filter(sharePointList, yourColumn.Value = listFilter)

 

There are some delegation issues with the above if that is a concern with your list sizes.  If not, then you can ignore them.  If so, then other steps would be needed to resolve that.

 

I hope this is clear and helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Mogammad
Level: Powered On

Re: Filter drop down based on a selected value

@RandyHayes 

Thank you for the solution.

 

I tried using a local variable before with the " UpdateContext({ VariableName: Value1}) " function, not understanding that the local variable cant be called on multiple screens.

 

Thanks.

View solution in original post

Helpful resources

Announcements
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

Demo Extravaganza Championship Voting Open

Voting Ends: October 30, 2019!

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

Top Kudoed Authors
Users Online
Currently online: 178 members 5,102 guests
Recent signins:
Please welcome our newest community members: