cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
VivekBhatt Advocate I
Advocate I

Display, remove and update People column with multiple values in SharePoint list

Hi All,

 

I have a SP List with the below structure.

I want to create a power app which will display all these depending on the Title and i should be able to Add and Remove users from this list. 

 

TitleAdmins
ABCPerson 1
Person 2
Person 3
XYZPerson 3
Person 4
Person 5
HNZPerson 6
Person 7
Person 8

 

Solution (I have done so far): i have a gallery where i have set its data source with " LookUp('ListName',Title="ABC",Admins) "

This displays list of all the person (1,2,3) i have added against ABC in SP list.

the part where i am getting stuck is deleting and adding record.

 

For deleting:  Remove(LookUp(ListName,Title="ABC",Admins),ThisItem) 

The code is not throwing any error but its not removing the item either

 

For Adding: Patch('ListName,{ID:1,Admins:DataCardValue73_1.SelectedItems});

I want to append the new value but its replacing 

 

3 REPLIES 3
Dual Super User
Dual Super User

Re: Display, remove and update People column with multiple values in SharePoint list

Hi @VivekBhatt 

 

To remove the record, you need to update the expression to:

Remove(ListName,ThisItem)

For adding the record:

Patch(ListName,Defaults(ListName),{ID:1,Admins:DataCardValue73_1.SelectedItems});

Defaults(ListName) is used to create a new record.

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

VivekBhatt Advocate I
Advocate I

Re: Display, remove and update People column with multiple values in SharePoint list

Hi @yashag2255 

 

Thanks for your reply, but the solution you gave works with standard list update or remove

If you see the structure i have you will know that Remove(List,ThisItem) will not work here 

Community Support
Community Support

Re: Display, remove and update People column with multiple values in SharePoint list

@VivekBhatt 

The most important thing is that the person column can only be updated instead of modification, which I think you have known.

The workaround is to patch a new person field to the record after it has been added or removed. Please try the following codes.

For deleting

 

ClearCollect(Mycol,Remove(LookUp('ListName',Title="ABC",Admins),LookUp(LookUp('ListName',Title="ABC",Admins),Claims=ThisItem.Claims)));Patch('List Name',LookUp('ListName',Title="ABC") ,{Admins:Mycol})

 

Snipaste_2020-01-23_11-29-57.png

 For adding

 

Clear(MyCol2);Collect(MyCol2,LookUp('ListName',Title="ABC",Admins),DataCardValue73_1.SelectedItems);Patch('List Name',LookUp('ListName',Title="ABC"),{Admins:Mycol2})

 

Snipaste_2020-01-23_11-30-28.png

 

 

Sik

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Top Solution Authors
Top Kudoed Authors
Users online (7,007)