Implementing Dynamics Dropdown Filtering in Canvas APP
Cascading dropdowns allow users to select values in a hierarchy. For example, when a user selects a Country, the State dropdown is filtered to show only states in that country. Similarly, selecting a State filters the City dropdown to show only cities within that state.
Step-by-step guide : Watch the Video or scroll to read the article.
- Data Source:
- Use a Dataverse table or an Excel file stored in OneDrive/SharePoint.
- Structure the data like this (Table Name:
LocationData
):CountryStateCityIndiaOdishaBhubaneswarIndiaOdishaCuttackIndiaKarnatakaBangaloreUSACaliforniaLos AngelesUSACaliforniaSan FranciscoUSATexasAustin
2️⃣ Add Controls to the Canvas App
- Country Dropdown
- Insert a Dropdown control (
DropdownCountry
). - Set the
Items
property of the dropdown to:powerappsCopy codeDistinct(LocationData, Country)
- Insert a Dropdown control (
- State Dropdown
- Insert another Dropdown control (
DropdownState
). - Set the
Items
property of the dropdown to:powerappsCopy codeDistinct(Filter(LocationData, Country = DropdownCountry.Selected.Result), State)
- Insert another Dropdown control (
- City Dropdown
- Insert another Dropdown control (
DropdownCity
). - Set the
Items
property of the dropdown to:powerappsCopy codeDistinct(Filter(LocationData, Country = DropdownCountry.Selected.Result && State = DropdownState.Selected.Result), City )
- Insert another Dropdown control (
3️⃣ Explanation of Key Concepts
- Distinct: Extracts unique values from the specified column.
- Filter: Filters records based on the conditions provided.
- DropdownCountry.Selected.Result: Gets the selected value from the Country dropdown.
- DropdownState.Selected.Result: Gets the selected value from the State dropdown.
Hope it helps.