cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DB_Gal
New Member

Can’t delete record SQL Server

I’m new to PowerApps. As my first test I hooked up a simple SQL Server table with 8 fields and an int identity primary key. I used the start with a database option in PowerApps to do this. Everything looks good. I can insert and update records. The only problem is I cannot delete. I can press the trash can icon and I get no error message but nothing happens. Why wouldn’t this work out of the box?
1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @DB_Gal ,

Could you please share a bit more about your issue?

Do you generate an app based on your SQL Table data source?

 

Based on the issue that you mentioned, I have made a test on my side, and don't have the issue that you mentioned. I assume that you generated an app (including three generated screens) based on your SQL Table data source, please consider set the OnSelect property of the "Trash" icon to following:

Remove('[dbo].[SQLTable]', BrowseGallery.Selected)

or

RemoveIf('[dbo].[SQLTable]', 'Primary Key Column' = BrowseGallery.Selected.'Primary Key Column')

In addition, please also make sure that you do not define any constraints within your SQL Table to prevent from deleting records from it.

 

If the issue still exists, please consider take a try with the following workaround:

Add the following formula within the OnSelect property of the Gallery:

...;
Set(CurrentItem, ThisItem)   /* <-- Add this formula */

Then modify above formula as below:

RemoveIf('[dbo].[SQLTable]', 'Primary Key Column' = CurrentItem.'Primary Key Column')

or

Remove('[dbo].[SQLTable]', CurrentItem)

 

Best regards,

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

View solution in original post

1 REPLY 1
v-xida-msft
Community Support
Community Support

Hi @DB_Gal ,

Could you please share a bit more about your issue?

Do you generate an app based on your SQL Table data source?

 

Based on the issue that you mentioned, I have made a test on my side, and don't have the issue that you mentioned. I assume that you generated an app (including three generated screens) based on your SQL Table data source, please consider set the OnSelect property of the "Trash" icon to following:

Remove('[dbo].[SQLTable]', BrowseGallery.Selected)

or

RemoveIf('[dbo].[SQLTable]', 'Primary Key Column' = BrowseGallery.Selected.'Primary Key Column')

In addition, please also make sure that you do not define any constraints within your SQL Table to prevent from deleting records from it.

 

If the issue still exists, please consider take a try with the following workaround:

Add the following formula within the OnSelect property of the Gallery:

...;
Set(CurrentItem, ThisItem)   /* <-- Add this formula */

Then modify above formula as below:

RemoveIf('[dbo].[SQLTable]', 'Primary Key Column' = CurrentItem.'Primary Key Column')

or

Remove('[dbo].[SQLTable]', CurrentItem)

 

Best regards,

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

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,311)