cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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.

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.