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

Help with splitting a multi-value person field from SharePoint list in PowerApps

Hello, and Happy New Year to you all,

 

I have a SharePoint list which contains a number of columns.  I want to use 2 of those to create a collection within a PowerApp.  The scenario is the list is a list of different teams, and contains details of who is in each team.  A person can be in more than one team.  It contains the following columns (amongst others):

 

TeamName - text field

TeamMembers - a multi-value person field

 

It looks a little like this:

 

RecordIDTeamNameTeamMembers
1HRJim;
Jane;
Bob;
Steve
2FinanceSteve;
Betty;
Ryan
3MarketingAlison;
Jenny

 

Note that the Steve in HR is the same as the Steve in Finance - i.e. he works in 2 teams.

 

The collection I'm trying to achieve would looks something this:

 

TeamNameTeamMember
HRJim
HRJane
HRBob
HRSteve
FinanceSteve
FinanceBetty
FinanceRyan
MarketingAlison
MarketingJenny

 

So 1 record per person, per team.  As Steve is in 2 teams, he has 2 records.

 

The use case here is I want to use this table to manage who can see / edit records within the app.  I want only HR people to be able to edit HR records, only Finance people to be able to edit finance records...etc.  Unfortunately our active directory does not have sufficient detail to use that as the source - this need is more nuanced than that.

 

Any help in how to achieve this would be much appreciated.

 

Thank you in advance

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Help with splitting a multi-value person field from SharePoint list in PowerApps

@desreed 

I would suggest using the UNGROUP function to unpack the grouped names.

ForAll(your_collection_name,
    Collect(my_solution_name,Ungroup(your_collection_name,"TeamMember"))
);

 

If you want to show only the TeamName and DisplayName you can take an extra step and use SHOWCOLUMNS.

ForAll(your_collection_name,
    ShowColumns(
        Collect(my_solution_name,Ungroup(your_collection_name,"TeamMember")),
    "TeamName",
    "DisplayName"
);

 

Please note that DisplayName is what the person object gets the employee name from.  You can rename it if you like using RENAMECOLUMNS.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

3 REPLIES 3
Super User
Super User

Re: Help with splitting a multi-value person field from SharePoint list in PowerApps

@desreed 

I would suggest using the UNGROUP function to unpack the grouped names.

ForAll(your_collection_name,
    Collect(my_solution_name,Ungroup(your_collection_name,"TeamMember"))
);

 

If you want to show only the TeamName and DisplayName you can take an extra step and use SHOWCOLUMNS.

ForAll(your_collection_name,
    ShowColumns(
        Collect(my_solution_name,Ungroup(your_collection_name,"TeamMember")),
    "TeamName",
    "DisplayName"
);

 

Please note that DisplayName is what the person object gets the employee name from.  You can rename it if you like using RENAMECOLUMNS.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

Highlighted
desreed
Level: Powered On

Re: Help with splitting a multi-value person field from SharePoint list in PowerApps

Thanks @mdevaney. - the UNGROUP function is what sorted it for me.

 

I couldn't get the formula you had in your second example to quite work, but got what I needed by creating a second collection, using the collection created by your first example as a source and SHOWCOLUMNS.  Exactly what I needed - thank you very much.

Staroni
Level: Powered On

Re: Help with splitting a multi-value person field from SharePoint list in PowerApps

Can you share the whole solution? How did you collect the Sharepoint Person field in Collection in Power App?

Thank you in advance

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (5,098)