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 Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

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

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.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,902)