cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Shibato
Level: Powered On

Cascading dropdown based on other list

Hi Guys,

I need some help with cascading dropdown list in PowerApps.

 

I have 3 lists:

  • NewEmployeeForm_Departments
    where I have only one Title column with departments description
  • NewEmployeeForm_Positions
    where I have one title column with job positions description and one lookup column connected with departments list
  • NewEmployeeForm
    many different columns and two lookup columns connected to departments and positions lists

I've prepared PowerApps form to third list, but unfortunately I'm not able to filter positions based on departments.

 

I tried two following scenarios:


  1. Department
    Choices(NewEmployeeForm.Department)
    Position
    Sort(Distinct(Filter(NewEmployeeForm_Positions;Department=DataCardValue2.Selected.Value);Title);Result)

    And this works fine - filter works. Unfortunately when I submitting the form Position column is empty. And it makes sense, because I am referring to the different list (NewEmployeeForm_Positions)

  2. Department
    Choices(NewEmployeeForm.Department)
    Position
    I tried with something like below, but probably it isn't good approach:
    Filter(Choices(NewEmployeeForm.Position);Department.Value=DataCardValue2.Selected.Value in NewEmployeeForm_Positions.Department)

    Could you Guys point me to correct way to achive that goal?
    Many thanks. 
1 ACCEPTED SOLUTION

Accepted Solutions
egallis
Level 10

Re: Cascading dropdown based on other list

Hi @Shibato,

If I understand your situation:

  • NewEmployeeForm_Departements
    • Title
  • NewEmployeeForm_Positions
    • Title
    • Department (lookup to Departments)
  • NewEmployeeForm
    • many columns
    • Departement (lookup to Departements)
    • Position (lookup to Positions)

In you form for the NewEmployeeForm list, once you have chosen a value for the Department field, you want to filter the list of values in the Position field according to the Departement field value.

If that's what you want to achieve, here is how you have to do it... In the Items property of your Position field, put the following code:

Filter(
Choices(NewEmployeeForm.Position),
Id in ShowColumns(
Filter(NewEmployeeForm_Positions, Department.Id=DataCardValue2.Selected.Id),
"ID"
)
)

Tell us if this works for you...

Emmanuel

 

3 REPLIES 3
LRVinNC
Level 10

Re: Cascading dropdown based on other list

 Take a look at Shane Young's video on cascading dropdowns which will take you step by step through the process - https://www.youtube.com/watch?v=pkZG2boN7jQ

egallis
Level 10

Re: Cascading dropdown based on other list

Hi @Shibato,

If I understand your situation:

  • NewEmployeeForm_Departements
    • Title
  • NewEmployeeForm_Positions
    • Title
    • Department (lookup to Departments)
  • NewEmployeeForm
    • many columns
    • Departement (lookup to Departements)
    • Position (lookup to Positions)

In you form for the NewEmployeeForm list, once you have chosen a value for the Department field, you want to filter the list of values in the Position field according to the Departement field value.

If that's what you want to achieve, here is how you have to do it... In the Items property of your Position field, put the following code:

Filter(
Choices(NewEmployeeForm.Position),
Id in ShowColumns(
Filter(NewEmployeeForm_Positions, Department.Id=DataCardValue2.Selected.Id),
"ID"
)
)

Tell us if this works for you...

Emmanuel

 

Shibato
Level: Powered On

Re: Cascading dropdown based on other list

Hi Guys,

@egallis your solution works perfect. Big thanks for your help Smiley Happy

@LRVinNC thanks for your suggestion.

 

Have a great day.