I've got a data table, and a few dropdowns that let me filter this data table. I'll like to be able to have an "All" option on each of the 3 dropdowns in question to let the end user broaden their search. Is this possible given the code snippets below?
Side note: If StateDropdown is set to "All" CityDropdown would need to be forced to set to "All". Once you view the code snippets you will see CityDropdown is dependent on the state selected in the StateDropdown.
Data Table (Items):
Filter ( AddColumns( 'ESN Ticket Tracker', "City", LookUp( 'Networking Device List Master', 'DNS Entity Name' = 'ESN Ticket Tracker'[@'Service ID'], City ), "State", LookUp( 'Networking Device List Master', 'DNS Entity Name' = 'ESN Ticket Tracker'[@'Service ID'], State ) ), Status = StatusDropdown.SelectedText.Value, State = StateDropdown.SelectedText.Value, City = CityDropdown.SelectedText.Value )
Sort(Distinct('ESN Ticket Tracker',Status),Result)
Sort(Distinct('Networking Device List Master', State),Result)
Sort(Distinct(Filter('Networking Device List Master', State=StateDropdown.SelectedText.Value),City),Result)
Solved! Go to Solution.
You don't want them nested. The causes the City formula to only be true if the State formula is true.
Nesting If statements doesn't always work the way we think it would in Power Apps. It evaluates each statement until it meets a true condition. So one of the state conditions is going to be true and it won't even evaluate the If for the city.
You have them as separate statements here:
State = StateDropdown.SelectedText.Value, City = CityDropdown.SelectedText.Value
Just add to those like this:
AllStates.Value = false,
State = StateDropdown.SelectedText.Value,
State = State,
AllCities.Value = false,
City = CityDropdown.SelectedText.Value,
City = City
Keep up to date with current events and community announcements in the Power Apps community.
A great place where you can stay up to date with community calls and interact with the speakers.
Check out the latest Community Blog from the community!