PowerApps: Convert multi-value person columns into collection? Split/Collect?
-
17-01-2021 - |
Question
Is there a method to take the contents of multiple multi-value person columns from SharePoint and convert it to one collection of individual values (one record per person) in PowerApps?
I believe I can leverage Split and Collect to achieve this, but am having trouble with the exact syntax to follow. Or does PowerApps automatically convert these columns to a table anyways and I'm overthinking it?
For testing, I have a form showing 3 multi-value person columns I want to pull info from and combine into a collection. On clicking a button the action below is taken and results are shown in a gallery whose datasource is this collection.
ClearCollect(Participants,
{Name: Value(Approver_DataCard1.DisplayName)},
{Name: Value(Reviewers_DataCard1.DisplayName)},
{Name: Value(Informed_DataCard1.DisplayName)})
So far, no luck. It creates 3 blank records. Even if it did work am not sure how I would pull additional user information; email, organization, etc.
Solution
I've just managed to implement your example. Check it out:
OnSelect property of the Collect button:
Clear(Participants);
Collect(Participants,DataCardValue19.SelectedItems);
Collect(Participants,DataCardValue20.SelectedItems)
Note: DataCardValue19 and DataCardValue20 correspond ot the "Reviewers" and "Informed" multiselect user pickers.
Items property of the ListBox:
Participants.DisplayName