cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Deleting a SP list item through App

Hi All,

I'm creating a bookings app, I want the user to view any bookings under their name and have the ability to cancel. Cancelling a booking should remove it from the SP list. I have the following code which is underlined:

 

Remove('vehicle_bookings',MyBooked.Selected)

 

'vehicle_bookings' - SP list

MyBooked - Gallery showing a collection called 'BookedVehicle' - which is a collection created from the source data on app start.

 

Any Ideas where I'm going wrong

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

@KathrynHughes 

Your issue there is that you have a Gallery that is displaying a Collection.  Even though it might have been created from a SharePoint list, when collecting a SharePoint list, the records lose their direct signature back to the datasource in order to be used in a function like Remove.  If the Gallery had been based on Items *directly* from your SharePoint list, your formula would have worked.

 

Consider changing your formula to this:

RemoveIf('vehicle_bookings', ID=MyBooked.Selected.ID)

This will use the ID to relate the record to be removed.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

3 REPLIES 3
Highlighted
Super User III
Super User III

@KathrynHughes 

Your issue there is that you have a Gallery that is displaying a Collection.  Even though it might have been created from a SharePoint list, when collecting a SharePoint list, the records lose their direct signature back to the datasource in order to be used in a function like Remove.  If the Gallery had been based on Items *directly* from your SharePoint list, your formula would have worked.

 

Consider changing your formula to this:

RemoveIf('vehicle_bookings', ID=MyBooked.Selected.ID)

This will use the ID to relate the record to be removed.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

Highlighted
Super User
Super User

When I am removing items selected in a gallery, I am using the following successfully:

      Remove(<ListName>,ThisItem)

RemoveItem.png

LRVinNC

------------------
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Highlighted

Works perfectly, thanks!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

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