cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

People Picker Cascading

Hi All,

i am trying to implement a cascading drop down. 

i have a list A where in 2 columns are there Title and Employee name (People Picker)

Requirement
i want to put up a drop down containing distinct title values from List A. Once i do that , i would want to filter out employee name based on selection of title drop down value in list b form.

Now the user can either save that default people picker value data populated from list A or also update the people picker with a new value while saving the form.

 

How can this be achieved?

 

Thanks in advance guys!!

Cheers!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Anonymous ,

Do you want to update  person field based on filtered person value in ?

Could you tell me whether that person field allows multiple value?

 

1)If yes, then you just need to set the combo box's defaultselecteditems to the filtered people.

You could use these default selected items to update, you could also choose other people to update.

Try this:

1.set the screen's OnVisible:

ClearCollect(test1,Filter(survey,First(Distinct(ListA,Title)).Result= Title));Clear(test2);ForAll(test1,Collect(test2,peo))

2. Select Dropdown1 and set its Items property to something like:

Distinct(ListA,Title)

set drop down1's OnSelect:

ClearCollect(test1,Filter(ListA,Dropdown2.Selected.Result= Title));Clear(test2);ForAll(test1,Collect(test2,'Employee name'))

3.set drop down2's Items:

Choices(ListA.'Employee name')

set Dropdown2's DefaultSelectedItems:

test2

 

2)If no, then you just need to set the combo box's defaultselecteditems to the filtered person

You could use these default selected items to update, you could also choose other people to update.

1. Select Dropdown1 and set its Items property to something like:

 

Distinct(ListA,Title)

 

3.set drop down2's Items:

 

Choices(ListA.'Employee name')

 

set Dropdown2's DefaultSelectedItems:

 

LookUp(ListA,Dropdown2.Selected.Result= Title).'Employee name'

 

 

 

Best regards,

 

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Mr-Dang-MSFT
Power Apps
Power Apps

Hi @Anonymous ,

If I am understanding correctly:

  • Dropdown1: show the distinct values for Title from ListA
  • Dropdown2: a people picker that shows employee names filtered by the Title selected in Dropdown1

You have the right keywords here: cascading, distinct, filter. These will be helpful for more examples as you search on the community.

 

Here's how you can achieve this:

1. Select Dropdown1 and set its Items property to something like:

Distinct(ListA,Title)

Dropdown1 is what I am referring to as the drop down control in your app that will hold the distinct Title values.

This gets the distinct values from the Title column from ListA (rename that as necessary).

Note that the Distinct() function is non-delegable, which may not return all the values you expect because it's only able to run on a limited number of records. If you only have a handful of known titles, it is more efficient to store them in their own list and point the Items property to that instead.

 

2. Select Dropdown2 and set its Items property to something like:

Filter(people_list,Title=Dropdown1.Selected.Title)

Here, people_list refers to the table of people you are using; change it to the name of your actual list of people.

The filter matches the Title for each person with the selection in Dropdown1 from the first step.

 

Another set of keywords you can use for more examples include "dependent drop downs."

Let me know what else you may need.

Anonymous
Not applicable

@Mr-Dang-MSFT the second code would fetch employee name? as i do not see any reference to people picker field. 

Hi @Anonymous ,

Do you want to update  person field based on filtered person value in ?

Could you tell me whether that person field allows multiple value?

 

1)If yes, then you just need to set the combo box's defaultselecteditems to the filtered people.

You could use these default selected items to update, you could also choose other people to update.

Try this:

1.set the screen's OnVisible:

ClearCollect(test1,Filter(survey,First(Distinct(ListA,Title)).Result= Title));Clear(test2);ForAll(test1,Collect(test2,peo))

2. Select Dropdown1 and set its Items property to something like:

Distinct(ListA,Title)

set drop down1's OnSelect:

ClearCollect(test1,Filter(ListA,Dropdown2.Selected.Result= Title));Clear(test2);ForAll(test1,Collect(test2,'Employee name'))

3.set drop down2's Items:

Choices(ListA.'Employee name')

set Dropdown2's DefaultSelectedItems:

test2

 

2)If no, then you just need to set the combo box's defaultselecteditems to the filtered person

You could use these default selected items to update, you could also choose other people to update.

1. Select Dropdown1 and set its Items property to something like:

 

Distinct(ListA,Title)

 

3.set drop down2's Items:

 

Choices(ListA.'Employee name')

 

set Dropdown2's DefaultSelectedItems:

 

LookUp(ListA,Dropdown2.Selected.Result= Title).'Employee name'

 

 

 

Best regards,

 

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Anonymous
Not applicable

@v-yutliu-msft the second option is my requirement where in the people picker does not allow multiple selection. 
i just have one confusion, i would get the filtered item based upon your requirement, however the user would have the option to remove the default user and select a new one. 
i guess then the defaultselecteditems property would cause an issue wouldn't it?

Hi @Anonymous ,

The  defaultselecteditems property would not cause an issue.

Defaultselecteditems property is used to set the selected items by default. It means that if you do not select any item, it will show one item as selected item by default.

This will not affect whether you delete the default selected item, choose a new item.

Usually, we use formula like this "Combox boxname.Selected" to represent the value to update person field.

That means that you will use the selected item to update value, no matter whether that is the default selected item or the new selected item.



Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,842)