I have created a powerapp using a gallery to allow me to easily add new items.
When an item is saved, it is patched to SharePoint.
When in edit mode "x" will discard your changes, or the item will be deleted if there are no values in the row.
What I am struggling with is, I can press the "Add New" button multiple times, which then introduces empty records into my app and into Sharepoint. I need a way to ensure all empty record are deleted.
Hi @yussuf0100 ,
You can disable the "Add" button on click and enable it again after "Save" button is clicked. It would save each row and allow you to add next row only when previous row is saved.
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.
Hey @pawanjajoo this is a great solution however when users press the new button, if they refresh the page, it stores the blank item.
I need a way to delete empty records when a page is refreshed.
Hi @yussuf0100 ,
What do you mean about "when a page is refreshed" in details?
Do you mean that refresh the website when playing this app?
If so, you could try to set this screen's OnVisible and app's OnStart:
Then when you load this screen and open this app, you will remove all the items that SHORT DESCRIPTION field is blank.
Thanks for responding. Yes, on Playing the App or using the "Refresh" icon on the page.
I tried this approach but all it seemed to do was delete all records in the sharepoint list being used.
try this Remove(SPList, Filter(SPList, Title ="")). basically this is as same as @v-yutliu-msft suggested.
Or else before calling the patch try to check if the values are not blank for the Fields... go for Patch in case of not empty.
Check out our new profile badges recognizing authored solutions!
We are excited to announce the Power Apps Super Users!
Did you miss the call? Check out the Power Apps Community Call here.
Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!