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
Solved! Go to Solution.
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.
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.
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
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.
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!!
Was it that you had the button inside the gallery?
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
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
203 | |
187 | |
70 | |
38 | |
34 |
User | Count |
---|---|
348 | |
268 | |
122 | |
78 | |
60 |