cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Post Patron
Post Patron

delete SPO list items

Hi All,

I am trying to create a button on an app that will delete all rows in a SPO list based on criteria in the APP.

 

I am looking for something like 

delete <ListName > where Emailaddress = VarEmail and period = VarPeriod.

 

I am trying to get removeIf and remove to work, but they keep failing 

RemoveIf(
<listName>,
EmployeeEmailAddress = VarUserID , PeriodName1 = TXT_PeriodName.Text

)

 

I am loading one list from another list of defaults, and if the user/period exist, I need to delete All items, and insert the new.

 

TIA,

Joe

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

@joef 

What kind of column is EmployeeEmailAddress?  If it is a Person column, you will need to adjust your formula to the following:

RemoveIf(<listName>,
   EmployeeEmailAddress.Email = VarUserID &&
   PeriodName1 = TXT_PeriodName.Text
)

Otherwise,  what error are you seeing?

 

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

7 REPLIES 7
Super User III
Super User III

@joef 

What kind of column is EmployeeEmailAddress?  If it is a Person column, you will need to adjust your formula to the following:

RemoveIf(<listName>,
   EmployeeEmailAddress.Email = VarUserID &&
   PeriodName1 = TXT_PeriodName.Text
)

Otherwise,  what error are you seeing?

 

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

Email address is a text field in my list, that gets populated from the app.  My app takes all data from a "defaults" list and patches the gallery to a history list.  The user has the ability to update the defaults before submitting this period's time allocation.

 

The error I am getting is, "The item can't be found".  I tried to use Trim figuring there may be some spaces...

 

Maybe I need to load a gallery with the items for the current period, then loop thru the gallery.allitems and delete one by one?

 

Not as easy as expected 🙂

 

Thanks again,

Joe

Adding the new gallery pointing to the list I want to delete worked...

I still get an error when the form refreshes that it can't find the item( Because it removed them already :)), but the list is cleared for the one user and the one period...

On to making it pretty.... If it doesn't look good it doesn't work!!

 

thanks again!

Joe

Super User III
Super User III

@joef 

Yes, it is easier than you are making it.  You don't need another Gallery to do this - main reason is that you are using a Gallery as a table in that case, an you can do that all in your formula.

 

So, what is your formula that you were getting errors from?

A screenshot would be helpful as well.

 

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

I was using your RemoveIf() from the gallery that was pointing to my default list and it threw the error.  No screenshot the error doesn't get captured in a screen shot.

I added a new screen with a gallery that points to my criteria, user = user and period = period.

I added a button and your code, and it works like a charm.  I believe the "Can't find item" error after it deletes the rows was only when I was playing the APP with the designer...  After I published it and ran it all is good 🙂

 

Thanks again for all your help!!

Super User III
Super User III

@joef 

Was it that you had the button inside the gallery?  

 

_____________________________________________________________________________________
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 @RandyHayes ,

It was in the gallery screen but not the gallery form. 

But I needed to setup a gallery to display if the user already submitted for the period, so it just kinda worked out 🙂

 

I am sure there are better ways, but as I create more, I learn more... 

 

Thanks Again,

Joe

Helpful resources

Announcements
News & Announcements

Community Blog

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

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (8,603)