ClearCollect is a function in Power apps that helps the user in clearing all the records from a file and then again storing the fresh records in the same file. Hence, the ClearCollect function is a combination that helps in performing two functions at a time which are first clear and then collect the data in the form of a table. In this article, we will talk about the collect and clear function in power apps, the creation of ClearCollect along with its uses and benefits. Then we will highlight the uses of power app functions and the method for clearing the collection inside a power app.
The collect function in power apps is used for adding records. The clear function can have the following components in it:
In case the data source is absent, a new collection gets formed that help in storing the global values sometimes. They can also form a duplicate copy of the data source that is temporary. There is another function called patch() that is used for creating records in the database.
Below is the syntax for collect() function:
Collect( Data_Source, items_number , ... )
Become a Powerapps Certified professional by learning this HKR Powerapps Training !
The clear function helps in clearing all the records from the file or we can say it deleted all the records from the collection not clearing the columns of the fields.
The clear function is only operational on collections and it does not operate on the data sources. There is a function called RemoveIf (Source_of_Data, true)that helps for the same purpose. This function tends to remove each and every record from the storage of the data source which in turn creates discrepancies in the records of other users. In that case, the user can use the Remove() function in case he wants to remove only a few records selectively. This function has no return value and hence can only be used in the behavior formula.
Below is the syntax for clear() function:
Collection: This field is always required where the user can create a collection that he wants to create.
ClearCollect is a function in Power apps that helps the user in clearing all the records from a file and then again storing the fresh records in the same file. Hence, the ClearCollect function is a combination that helps in performing two functions at a time which are first clear and then collect the data in the form of a table.
Below is the syntax for ClearCollect() function:
There are a few prerequisites for creating and using ClearCollect in power apps. They are:
1. The initial step is to add a Text input control. In case the user wants to rename it, he can click on the 3 dots present below the section and select rename then insert the product name of his choice.
2. The second step is to add a dropdown control.
3. The drop-down can also be renamed as per the user’s wish. A user should always select the property as Items in the list.
4. The user now needs to replace the drop-down and add a button and add the property as Add to the text button. Let us do this with the expression below:
5. ProductName column should be added with some text and color selection has to be done. Press Add
6. The previous step has to be repeated 2 or more times.
7. The menu will finally look like this:
1. The user needs to select the template from the gallery by clicking at the gallery bottom. Then, click the pencil icon present in the up-left corner. Press trash and then choose.
2. Add (RemoveProductList,Item) by clicking OnSelect
3. There is a button clear for clearing the product list by using the function Clear(productList)
4. For removing an item, the item will be removed from the collection.
Want to know more about Powerapps,visit here Powerapps Tutorial !
There are a lot of powerApp functions listed below:
Related blog: What Is PowerApps
1. Color Functions
2. DataSource Functions
3. Data and Time Functions
4. Error Functions
5. Information Functions
6. Logical Functions
7. Math Functions
8. Navigation Functions
9. Offline Function
10. ReadNFC: This property helps to read the NFC
11. Blank: This property helps to return the blank value for inserting a NULL value
12. Notify: This property helps in displaying the banner
Top 30 frequently asked PowerApps Interview Questions !
Let us assume there are a few unwanted records that the user does not want in his collection and he wants to remove them. Then he can make the use of PowerApp for performing this. If the user uses the remove() function, only a specific record is deleted from the collection. For choosing each item individually, the user needs to press the bin button again and again for clearing the data. After choosing, the user clicks on the submitted data, hence the item is removed from the collection. Other methods might remove all the items from the collection which is comparatively a risky thing to do. There are two main ways for removing the data from the collection:
Related blog: Powerapps Canvas
In this article, we have majorly discussed the 3 main functions which are collect(), clear() and CollectClear(). We have discussed the uses of all these 3 functions along with their syntax and uses. ClearCollect function is actually a combination that helps in performing two functions at a time which are first clear and then collect the data in the form of a table. Then we talked about the major CollectClear functions such as logical functions, numeric functions, color functions, data source functions, etc. last, we discussed the 2 main ways of deleting a collection.
Batch starts on 6th Dec 2022, Weekday batch
Batch starts on 10th Dec 2022, Weekend batch
Batch starts on 14th Dec 2022, Weekday batch
This is performed using the clear() function.
The collections have a function called collect() that helps in adding a record to the list.
The collections are stored in the menu under the file-> collections tab.
Collections have a size of about 2000 records.
Clear: The clear function helps in clearing all the records from the file or we can say it deleted all the records from the collection not clearing the columns of the fields.
CollectClear: ClearCollect is a function in Power apps that helps the user in clearing all the records from a file and then again storing the fresh records in the same file.
The variables are very similar to data sources. They contain a number of records of each file.
This is performed using the edit option in the gallery of the PowerApp which is located on the right side of the page.