How to Create a Power Apps Collection Manually?

In this Power Apps tutorial, I will explain how to create a Power Apps collection manually step by step.

A Power Apps collection is a group of data like a table, which stores the data in a Power App memory. Once the collection is created, it can be accessed all over the screens in a Power Apps app.

Create a Power Apps Collection Manually

Follow the below steps to create a Power Apps collection manually.

  • Then we will provide a heading to it, so add a text label control -> provide a text property based on your requirement:
How to create a Power Apps app collection manually
  • Now, create an edit form manually for order booking. So, we will add six label controls and then change the text property for each of them as shown below:
Text Label controlText Property
Name“Name:”
Email“Email:”
Product“Product:”
Product Cost“Product Cost:”
Order Date“Order Date:”
Product Image“Product Image:”
Create a collection in Power Apps

We will add input controls for the end users for all the next-to-label controls.

  • Now, for the two label controls [Name and Email], we will add the text input control next to them. Then, we will provide the Hint text for both of them as
Name text input: "Provide your name"
EMail text input: "Provide your mail address"
Create an collection in Power Apps manually
  • Now, for the third label control [Product], we will add a drop-down control for it. Then provide the Items property as:
Items = ["iPhone","Samsung","OnePlus"]
Create a collection in Power Apps manually
  • The input should be based on the drop-down control for the 4th label control [Product Cost]. So, we will add another label control because the end-user should not change it.
  • Now, in the Text property, provide the code as:
Text = If(drp_OrderedProduct.Selected.Value="iPhone","$1300$",If(drp_OrderedProduct.Selected.Value="Samsung","1250$","1150$"))
Collection in Power Apps
  • Now, for the 5th label control [Ordered Date], we will add the Date picker control. Then, in the DefaultDate property, the code should be based on today’s date.
DefaultDate: Today()
Collection in Power Apps canvas app

The input should be based on the drop-down control for the 6th label control [Product Image]. Based on the drop-down values the image should display. The dropdown values are:

  • iPhone
  • Samsung
  • OnePlus

So for that, we will add those three images using image control and make their visible property off.

  • Add the three images of the Product using image control.
Power Apps canvas app collection
  • Now, I need to off the visible property for all the image control.
  • To off the visible property, select the image control -> In the image property pane, turn off the visible property.
Create a collection in Power Apps canvas app
  • Then, image control won’t be visible as shown below:
How to create a Power Apps app collection
  • Then, do the same for all the remaining image control by turning off the visible property.
How to create a Power Apps collection
  • Now, next to the 6th label control [Product Image] add an image control, where the image should be based on drop-down control.
  • Then in the Image property, provide the code as:
Image: Switch(drp_OrderedProduct.Selected.Value,"iPhone",Iphone,"Samsung",Samsung,"OnePlus",Oneplus)
How to create a Power Apps collection manually

Now, we will add the button control to it. Whenever the user clicks on the button, I need to create a group of data [collection].

  • Add a button control to a form, then change the text property to “Book” and the Fill property to pink.
Create a Power Apps canvas app collection
  • In the Button OnSelect property provide the code as:
OnSelect: Collect(colOrder,{Name:txt_Name.Text,'EMail ID':txt_EMail.Text,'Ordered Product':drp_OrderedProduct.Selected.Value,'Product Cost':lbl_Productcost.Text,'Ordered Date':dte_OrderedDate.SelectedDate});
Create a Power Apps collection

Now as end users, we will add some of the data later by clicking on the Preview the app.

How to create a collection in Power Apps

Once the end-user clicks on the Book button control, I want to store the data. Now we will see where the data will be stored.

  • On the right-hand of the Power Apps page, click on the Variables icon (x) ->Then click on the Collections.,
  • Once you click on it, it will provide the collection name you created; click on the More options (…) -> Select View Table.
Create a collection using Power Apps canvas app manually
  • Now, it will display the stored data in the collection.
Create a collection using Power Apps canvas app
  • Now, we will see how to reset all the end-user details which are provided in the form. For that add another button control next to a Book button control.
  • Then in the text property, provide the text as Reset, and in the OnSelect property, provide the code as:
OnSelect: Reset(txt_Name);Reset(txt_EMail);Reset(drp_OrderedProduct);Reset(dte_OrderedDate);
How to Create a Power Apps Collection
  • All their provided information will be reset once the end-user clicks on the Reset button control.
Create an collection using Power Apps

Conclusion

I hope you got to know now, how to create a Power Apps collection manually.

You may also like: