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

deleting multiple items from SP list

hi 

 

so in my app I have a collection which pulls together all the room bookings from all the room lists (SP lists) for this user

 

now using a checkbox in the gallery , I want to delete all items from the original SP list  when the tick box is selected and where certain details match certain details in the list item.

 

this is the formula which i came up with but it seems to delete all items in that room list even if you only select 1 

ForAll('gal-my bookings'.AllItems,If('cb-m-bookings-select'.Value=true,
If(ThisRecord.Room="Main School ICT Room",RemoveIf('MS-ICT','booked from'=ThisRecord.'booked from',Lesson=ThisRecord.Lesson, name=ThisRecord.name),
If(ThisRecord.Room="Trolley A",RemoveIf(TrolleyA,'booked from'=ThisRecord.'booked from',Lesson=ThisRecord.Lesson,name=ThisRecord.name)))));
16 REPLIES 16
Super User III
Super User III

@daniels471 

Actually...as monstrous as the JSON dump was from the trace you provided, I decided to digest through that as best I could to discover any issues, because I figured with screenshots, that we would get to a back and forth with a "click there and send another screenshot" series of messages.

 

So, I see that you have a good chunk of formula below the formula we are working on that collects into a bookedsessions2 collection.  That one needs some work!

 

But, sticking with the current formula, I do see that an attempt to delete from each of the lists is being done in one execution.  It is indicating a delegation issue.  So, before I go down the wrong path...what is the current number of records in your lists - or, are they over 2000 currently?

 

 

_____________________________________________________________________________________
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!

hi 

 

the collect formulas is collecting all the items from multiple SP lists which we have just deleted from to update the contents of the gallery as the gallery shows everything in the "bookedsessions2" collection, as far as i was aware it was working ,but I may be wrong.

 

as for the delegation , I don't anticipate each list going over the 2000 record limit

Super User III
Super User III

@daniels471 

Okay...then I need to scrub through the dump you sent a little more to see if I can discover a root cause.

If you don't hear back from me within the next day or so...nag me!

_____________________________________________________________________________________
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!
Super User III
Super User III

@daniels471 

Can you send me a screenshot of the current formula you have?  Especially showing any delegation warnings it may have.  I am trying to match the trace dump with the formula and want to see if there is anything I can connect from the trace.

Thanks!

_____________________________________________________________________________________
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!
Helper II
Helper II

formula pt1.PNGformula pt2.PNGformula pt3.PNGformula pt4.PNG

Helper II
Helper II

hi 

 

just want to update you on things 

so I have majorly simplified how the app works now by combining everything in to one list and therefore making sure my formulas delegate ( which was the reason for the separate lists previously to stay under 2000 records )  .

so now the formula I have used for this part which is now one single list is as follows  

 

ForAll( RenameColumns(Filter('gal-my bookings'.AllItems, 'cb-m-bookings-select'.Value = true), "ID", "ID1"),
Remove(Bookings_DB,
LookUp(Bookings_DB,
ID = ID1)) )

View solution in original post

Super User III
Super User III

@daniels471 

Simple is better!!

However, to simplify further, your formula should be this:

ForAll( 
   Filter('gal-my bookings'.AllItems, 'cb-m-bookings-select'.Value = true) As gb,
   RemoveIf(Bookings_DB, ID=gb.ID)
)

Your posted formula would be making two data operations - Remove and LookUp.  The above uses one operation. 

_____________________________________________________________________________________
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!

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Top Solution Authors
Top Kudoed Authors
Users online (53,866)