I noticed the need when commenting to the PowerApps forum and decided to create a blog on it. So, what exactly is it?
Requirement
In a combo box, display the names of people. Share Point and the Multi-select person or group field are the sources. The criteria is to keep the Person or Group Type and all of its properties (DisplayName, Email, Department, Claims, and Job Title).
SharePoint-Multi Select-Person
Expected Results (Combo Box)
Display Distinct Person from Share point’s Multi people column
Person column is always unique, and multi-Select adds to the difficulty. I was going to just ungroup it, but Distinct and Sort aren’t going to help us unless we do some tricks.
Combo Box
Set the items property of the Combo Box to
With({Items: Ungroup(ForAll(SPList,MultiplePeopleColumn),”Value”),
DistinctEmail:Distinct(Ungroup(ForAll(SPList,MultiplePeopleColumn),”Value”),Email)},
Sort(
ForAll(DistinctEmail,First(Filter(Items,Email=Result))),
DisplayName
)
)
References
Conclusion
We are able to display the Person or group in the combo box using With function and maintain the Person Type.