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

Remove() Not Working With SQL Table

For this inventory tracking app I'm working on I have several SQL and SharePoint databases in use. I'm trying to build a "delete this record and all related records from all databases" button to keep things clean, but one of the SQL databases won't work for some reason.

I've tried various methods, Remove, RemoveIf, trying it from Power Automate, but none are working. I hope these pictures convey enough to answer any questions you may have. I can see in both Powerapps and the Monitor, that it doesn't error out. I can't figure out why the Monitor shows that it finds the record, but doesn't go through with deleting it.

I appreciate any help or knowledge I can recieve.

2021-02-15 12_37_08-Warehouse Management - Saved (Unpublished) - Power Apps.png

2021-02-15 12_36_02-.png

3 REPLIES 3
v-jefferni
Community Support
Community Support

Hi @BakerGroupAlex1 ,

 

Could you please share more details about your scenario? What do you mean by "all related records from all databases"? Since I have not seen any related records in other tables in your screenshot.

 

If you would like to delete a single record from data source within a Gallery, you could use Remove function to achieve the need.

 

On you end, you could apply below formula in OnSelect of the cross icon:

Remove(TableName, ThisItem)

 

 Please refer to the sample in below doc:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-remove-removeif#tras...

 

You were not able to remove a record with that formula is because TimeStamp is NOT an actual column but a meta data in the table I think, you could use Id value instead.

 

Then speaking of remove related records in other tables, please share more details about the relationship between those tables.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

PaulD1
Super User
Super User

Remove() should work. Note that RemoveIf does not delegate even in SQL and so should be avoided.

Looks like your LookUp is returning data so I think my next step would be to check whether you can delete the record directly in SQL - possibly it is participating in a relationship and integrity rules are set such that the record cannot be deleted while dependents exist, though it would be nice if PowerApps passed that message through to your App so it was obvious.

BakerGroupAlex1
Frequent Visitor

Apologies for the late response! It has been one of those kinds of weeks.

What I meant by "all related records from all databases" is just an ID column that shares a value in other databases. There are no dependencies or special rules going on, they're very simple and basic databases. I have tried using:
Remove(TableName, ThisItem). But unlike in the original post, it fails to find the record and throws a 404 error.

 

To answer the question: yes I am able to directly delete records through SQL, it's how I've been getting by thus far.

Here is what this particular database looks like:
 

 

I don't think, "You were not able to remove a record with that formula is because TimeStamp is NOT an actual column but a meta data in the table I think, you could use Id value instead" is applicable here, though I only have a passing knowledge in SQL.

Appreciate the responses!

 

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 Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (77,221)