2018-11-20

In this post, we will see how to implement a cascading dropdown list within the PowerApps application for a list with the two lookup columns where it has to display only the parent values if there are any associated child items.

List data setup:

  • SharePoint list “CarGroup” with the following data.
    • Tata Motors
    • Fiat Chrysler Automobiles
    • Apple
  • SharePoint list “CarBrands” with the lookup column “CarGroup” – with the Title column.
    • Alfa Romeo : Fiat Chrysler Automobiles
    • Landrover : Tata Motors
    • Fiat : Fiat Chrysler Automobiles
    • Jaguar : Tata Motors
  • SharePoint list “Car” with the lookups columns for the above lists and other data
    • Discovery :  Jaguar : Tata Motors 

We want to display the list of car groups and brands as a cascading dropdown and display the list of car groups which have an associated brand. By default the list form displays all the CarGroups as below.

Customise the Form using the PowerApps:

  1. Customise the Form

 

2. Add the CarGroup and CarBrand list as a Data source

 

Set the Group DataCard and Dropdown Items (First Level):

  •  Set the Group DropDown field items:

“Filter(Choices(Cars.Group),!IsEmpty(Filter(CarBrands,CarGroup_x003a_Title.Value = Value))).Value”. This displays only the list of relevant groups which has some brands to it. So for the above mention Data list setup, it will display “Tata Motors” and “Fiat Chrysler Automobiles” only.  

Notice that there is Delegation warning as we are trying to filter it using the Lookup fields. Thanks to Eickhel Mendoza(@Eickhel) for helping me with the work around solution, I changed it to add a new column before filtering it. “Filter(Choices(Cars.Group),!IsEmpty(Filter(AddColumns(CarBrands,”CarGroupTitle”,CarGroup_x003a_Title.Value), CarGroupTitle = Value)))”

Set the Brand DataCard and Dropdown Items (2nd Level):

  • Set the Brand Dropdown field items:

“Filter(AddColumns(CarBrands,”CarGroupTitle”,CarGroup_x003a_Title.Value), CarGroupTitle = GroupDropDown.Selected.Value)” to display only the brands for the selected group.

  • Set the Brand DataCard to update:

Update : {‘@odata.type’ : “#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference”,Id:BrandDropDown.Selected.ID, Value :BrandDropDown.Selected.Title} to update the list item.

Custom List form:

  • The Group will display all the Car groups containing the brands (except Apple).

  • The Brand will display all the Car brands for the selected group.

About the author 

Balamurugan Kailasam