I have built an app for few users and one of the functions is to delete records from SQL database table. I have tried to use ForAll and Remove IF functions, but these two functions delete records one by one and takes too much time for huge record deletion.
wondering how can i delete 2000 records from SQL table via powerapps quickly.
Please provide your suggestions.
Hello @dd96
The ForAll function would be not good if you have more 2000+ data.
What you can do is create a flow that will run your delete SQL script.
As for best practice, you should make stored procedures for it. This is just an extra option. you can always settle for a simple query in Power Automate.
Just in case you my answer helped you solve your problem, please mark/accept this as a SOLUTION. This helps community members if they experience a similar issue in the future. |
bistek.space @cha_bistek @BisTekSpace |
Thanks for the response. I was thinking the same and let you know how it goes.
thank you
I am able to implement bulk deletion by stored procedure and power automate.
stored procedure:
create procedure BulkDeletion
@ID int
as
begin
delete from table_name
where tableid = @ID
end
go
Power Automate Flow:
Power app
on Delete icon for each item:
Collect(collection_delete,[ThisItem.Id]);
it collects unique ids and will remove items from collection only, not from database
on Save button where actual deletion will be performed :
Set(testflowresult,ForAll(collection_deletion,testflow.Run(collection_deletion[@Value]).status));
set will wait for the flow's response and will not execute next commands until it finish
I was having issue with openjson otherwise it is a good option too.
User | Count |
---|---|
254 | |
112 | |
92 | |
48 | |
38 |