Create and update a collection in a canvas app (contains video) - Power Apps (2024)

  • Article

Use a collection to store data that users can manage in your app. A collection is a group of items that are similar, such as products in a product list. For more information about different types of variables such as collections: Understand canvas-app variables.

Prerequisites

  • Sign up for Power Apps, and then sign in by providing the same credentials that you used to sign up.
  • Create an app or open an existing app in Power Apps.
  • Learn how to configure a control in Power Apps.

Watch this video to learn how to create and update a collection:

Create a multicolumn collection

  1. In Power Apps Studio, add a Text input control.

    Create and update a collection in a canvas app (contains video) - Power Apps (1)

  2. Rename the control by selecting its ellipsis in the left navigation pane, selecting Rename, and then typing ProductName.

    Create and update a collection in a canvas app (contains video) - Power Apps (2)

  3. Add a Drop down control.

    Create and update a collection in a canvas app (contains video) - Power Apps (3)

  4. Rename the Drop down control Colors, and make sure that the Items property is selected in the property list.

    Create and update a collection in a canvas app (contains video) - Power Apps (4)

  5. In the formula bar, replace DropDownSample with this expression:

    ["Red","Green","Blue"]

  6. Add a Button control, set its Text property to "Add", and set its OnSelect property to this formula:

    Collect( ProductList, { Product: ProductName.Text, Color: Colors.Selected.Value })
  7. Press F5, type some text into ProductName, select an option in Colors, and then select Add.

    Create and update a collection in a canvas app (contains video) - Power Apps (5)

  8. Repeat the previous step at least two more times, and then press Esc.

  9. If you're using the preview version of Power Apps Studio, select the Variables pane and then select Collections to see the collections that you created.

    Create and update a collection in a canvas app (contains video) - Power Apps (6)

    If you're using the classic version of Power Apps Studio, on the File menu, select Collections.

    Create and update a collection in a canvas app (contains video) - Power Apps (7)

Show a collection

  1. Add a vertical Gallery control.

    Create and update a collection in a canvas app (contains video) - Power Apps (8)

  2. Set the gallery's Items property to ProductList.

  3. In the Data pane, set the subtitle field to Color, and set the title field to Product.

    Create and update a collection in a canvas app (contains video) - Power Apps (9)

  4. Close the Data pane, select the gallery, and then set the Layout field to Title and subtitle.

    Create and update a collection in a canvas app (contains video) - Power Apps (10)

    Your screen resembles this example:

    Create and update a collection in a canvas app (contains video) - Power Apps (11)

Remove one or all items

  1. Select the gallery template by clicking or tapping near the bottom of the gallery and then clicking or tapping the pencil icon near the upper-left corner.

    Create and update a collection in a canvas app (contains video) - Power Apps (12)

  2. Add a Trash icon to the gallery template.

    Create and update a collection in a canvas app (contains video) - Power Apps (13)

  3. Set the icon's OnSelect property to this formula:

    Remove(ProductList, ThisItem)

  4. Outside the gallery, add a button, set its Text property to "Clear", and set its OnSelect property to this formula:

    Clear(ProductList)

  5. While holding down the Alt key, select the Trash icon for an item to remove that item from the collection, or select the Clear button to remove all items from the collection.

Put a list into a collection

  1. Create a connection to a list created using Microsoft Lists.

  2. Add a button, and set its OnSelect property to this function, replacing ListName with the name of your list:

    Collect(MySPCollection, ListName)

    This function creates a collection that's named MySPCollection and that contains the same data as your list.

  3. While holding down the Alt key, select the button.

  4. (optional) To preview the collection that you created, select Collections on the File menu.

For information about how to show data from Microsoft Lists or SharePoint (such as dates, choices, and people) in a gallery: Show list columns in a gallery. For information about how to show data in a form (with drop-down lists, date pickers, and people pickers): Edit form andDisplay form controls.

Next steps

Feedback

Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see: https://aka.ms/ContentUserFeedback.

Submit and view feedback for

Create and update a collection in a canvas app (contains video) - Power Apps (2024)
Top Articles
Latest Posts
Article information

Author: Lidia Grady

Last Updated:

Views: 6405

Rating: 4.4 / 5 (65 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Lidia Grady

Birthday: 1992-01-22

Address: Suite 493 356 Dale Fall, New Wanda, RI 52485

Phone: +29914464387516

Job: Customer Engineer

Hobby: Cryptography, Writing, Dowsing, Stand-up comedy, Calligraphy, Web surfing, Ghost hunting

Introduction: My name is Lidia Grady, I am a thankful, fine, glamorous, lucky, lively, pleasant, shiny person who loves writing and wants to share my knowledge and understanding with you.