cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Meneghino
Level 10

Information returned from Remove, illogical

When I Remove an item from a data source and collect the result in a collection, the collection contains the items remaining in the data source but not the deleted item.

Is this really the intended behaviour?  It seems bizarre at best since in any case only up to 500 records will be returned, so this is completely useless.  Much better to return the list of removed items, so that we can check that the operation has completed correctly.

Here is the code:

ClearCollect(MyReturnedItems, Remove(MySource, MyItem))

Even more bizarre is that RemoveIf does the same thing, making it impossible to check what records have been actually removed.

 

Any clarifications form the PowerApps team would be welcome.

7 REPLIES 7
mr-dang
Level 10

Re: Information returned from Remove, illogical

Inverting the formula worked for a quick test I just ran. Does this work for you?:

 

Remove(MySource,ClearCollect(MyReturnedItems,MyItem))

 

Microsoft Employee
@8bitclassroom
Meneghino
Level 10

Re: Information returned from Remove, illogical

Hi @mr-dang

I appreciate that the result of your formula is that MyReturnedItems contains the item that you wanted to delete.

However, there is no indication as to whether this item was really deleted or not.  Your formula will return the item even if it is not actually deleted, even if there is no internet connection.

That is why it is important to collect the result of Remove (and RemoveIf and Patch) in a collection to be able to confirm to the user that the operation has completed successfully.

This is particulalrly important now that PowerApps has significant bugs in connecting to data sources like Azure SQL Database and SQL Server.

Thank you.

Community Support Team
Community Support Team

Re: Information returned from Remove, illogical

Hi @Meneghino,

 

Thanks for the feedback.

I think the issue here should be related with the Delegation.

Remove and the Removeif function would return the modified data source as a table, but those two functions both do not support delegation.

See: 

"

Remove and RemoveIf return the modified data source as a table.

Delegation

When used with a data source, these functions can't be delegated. Only the first portion of the data source will be retrieved and then the function applied. The result may not represent the complete story. A blue dot will appear at authoring time to remind you of this limitation and to suggest switching to delegable alternatives where possible. For more information, see the delegation overview.

"

Adding the function reference:

Remove and RemoveIf functions in PowerApps

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Meneghino
Level 10

Re: Information returned from Remove, illogical

Hi @v-micsh-msft

Could you please clarify how we can verify if a Remove or RemoveIf operation has actually worked?

With a Patch this is done by looking at the returned records, but this does not seem possible with Remove or RemoveIf.

Many thanks.

Super User
Super User

Re: Information returned from Remove, illogical

If the intention is to verify that the Remove or RemoveIf operation has worked, maybe you could accomplish this by calling the Errors function? If this returns no rows, I think we can probably assume that the operation worked.

 

As a quick test, I created a set of related tables.

 

 Temptable1.JPG

 

I then called the following function to remove all the records in TestTable.

RemoveIf('[dbo].[TestTable]', ID>0)

 

Afterwards, the Errors function reported errors on record IDs 3 and 4 due to referential integrity, which is what I'd expect. 

 

CaptureError1.PNG

I understand that what you want is positive confirmation of the records that were deleted. But in the absence of this feature, perhaps  the Errors function can be of some help?

Meneghino
Level 10

Re: Information returned from Remove, illogical

Hi @timl, thanks for the feedback.

You are correct, I would like to have positive confirmation and the number of records deleted.  In its absence I guess we could use the Errors function.

Much easier/logical to just return the deleted records.  Unclear to me why such a design choice was made.

Meneghino
Level 10

Re: Information returned from Remove, illogical

Hi all, if you are interested I have created this idea.

https://powerusers.microsoft.com/t5/PowerApps-Ideas/Delete-and-DeleteIf-functions-i-e-not-Remove-and...

Thank you,

Meneghino

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 329 members 5,635 guests
Please welcome our newest community members: