Showing results for 
Search instead for 
Did you mean: 

Command to explicitly drop a collection in PowerApp script

I would like to be able to delete a collection explicitly in a Power App script. This would permit me to be able to "reset" a collection easily during development, and to remove a collection after it had served its purpose.


A call such as DeleteCollection(collectionName) or DropCollection(collectionName) would be useful.  This call would apply to in-application collections only.  Calling this function on a SharePoint List, or other persistent store should result in an error.


The return type of the function should be a Boolean value with true indicating that the collection had been deleted.  Further references to a Deleted collection would cause error conditions to be raised.

Status: New
Regular Visitor

I think you are little bit confused to how collections work. 


To create a collection, you simply use Collect or ClearCollect to a collection name of your choice. 


Collect(CollectionName, {Value: BarcodeScanner.Value})


To delete items in a collection you can use Clear or ClearCollect 


To remove / drop / delete a collection all you need to do is remove any references to it, so any place you have put Collect etc, just remove it, then exit the app, ensuring it is fully closed the collection will then no longer exist. 


This is because variables are created implicitly, as and when they need to you do not need to declare and you do not need to delete, dispose of them either.


PS I had collection stuck in an app once that was collecting images, I found that I had accidently placed a collect on the OnVisible property for a screen I had duplicated a few times, very annoying. Check your app.

Advocate II

I get it that you just have to delete all references to it, but when you get into a larger app with lots of screens and hundreds of controls, it can be difficult to find where a collection is to delete its reference.  It underscores the importance of documenting use of variables, collections, etc. as you build the app.  But it would sure be nice to have a 'search' for some of these things.

Frequent Visitor

I agree that a delete collection command would be very helpful. The clear command will only delete the values in the table (the column headers still exist). If you want to reuse the collection for a different table, you'll have all these extra columns that will cause issues.

Post Patron

I would love the ability to completely delete a collection from the app. When a new Collect action is ran, this should remake the collection.