cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Delete Empty Records from gallery and SharePoint

Hi All,

 

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. 

 

Any ideas?

powerapp.PNG

5 REPLIES 5
Resolver I
Resolver I

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.

 

--------------

Pawan

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:

RemoveIf(datasourcename,IsBlank(SHORT DESCRIPTION))

Then when you load this screen and open this app, you will remove all the items that  SHORT DESCRIPTION field is  blank.

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hey @v-yutliu-msft 

 

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.

 

 

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.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (29,537)