简体   繁体   中英

Update ForeignKey Sharepoint List using onSelect button with Patch() - PowerApps

My problem is what I describe in the title. I want to update a foreign key on my sharepoint list with a button.

I have two List with OneToMany relation:

User{ ID, Name, Surname}
Book{ID, Title, Author, ID_User}

When I go one user, with a gallery, i can see the book related with a Filter:

Filter(Book,BrowseGallery1.Selected.ID = ThisRecord.IDUser.Id)

In this gallery i want to add a Trash and when i click the button remove the Book of this User, soo i want to remove the relation and see only the book related with this user.

I try with:

Patch(ThisItem, First( Filter(Book, BrowseGallery1.Selected.ID = ThisRecord.IDAnagrafica.Id)), { ID_User:  0} )

But give me an error. I try this patch with other columns like {Title: "TEST"} and it work.

Patch(ThisItem, First( Filter(Book, BrowseGallery1.Selected.ID = ThisRecord.IDAnagrafica.Id)), { ID_User:  ""HERE WHAT I NEED TO SET""} )

Thx for help

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM