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
)
StatusDropdown (Items)
Sort(Distinct('ESN Ticket Tracker',Status),Result)
StateDropdown (Items)
Sort(Distinct('Networking Device List Master', State),Result)
CityDropdown (Items)
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:
If(
AllStates.Value = false,
State = StateDropdown.SelectedText.Value,
State = State,
),
If(
AllCities.Value = false,
City = CityDropdown.SelectedText.Value,
City = City
)
)
User | Count |
---|---|
124 | |
87 | |
86 | |
75 | |
69 |
User | Count |
---|---|
214 | |
181 | |
140 | |
96 | |
83 |