Power Apps: Use Patch To Create Records Without Forms [Power Platform Series - Ep. 13]
Power Apps: Working With Power Apps Collection Basics [Power Platform Series - Ep. 12]
In this tutorial, Matt Peterson, a trainer at Pragmatic Works, walks through how to use collections in Power Apps Canvas Apps to improve user experience and streamline data entry. Drawing from a real-world scenario, Matt demonstrates how predefined comments can be quickly selected by users instead of manually typed, making applications more efficient and user-friendly.
Introduction to Collections in Power Apps
Matt Peterson begins by explaining the purpose of collections in Power Apps. Collections allow developers to temporarily store data in-memory, making it easier to manipulate and reuse within an app. In this case, collections are used to store predefined comments that users can select when filling out a form.
Setting Up the Example Application
Using a park inspection app as an example, Matt shows how to enhance a form by adding suggested comments. Instead of requiring users to type repetitive feedback, the app provides selectable options.
- A form is already created for submitting park inspections.
- The goal is to allow users to quickly add comments such as “Needs landscape maintenance” or “Vandalism present.”
- This is achieved by integrating a gallery and collections.
Creating a Data Source with the Table Function
Matt introduces the Table function to define static records that will serve as the data source for the gallery.
- A blank vertical gallery is inserted into the app.
- The default data source is replaced with a custom table.
- Sample records include:
- Needs landscape maintenance
- Vandalism present
- All looks good
This approach allows developers to quickly define reusable comment options without relying on an external database.
Enhancing the Gallery with Checkboxes
Next, Matt Peterson demonstrates how to make the gallery interactive by adding checkboxes.
- A checkbox is inserted into the gallery’s template cell.
- The checkbox text is dynamically set using
ThisItem.Comment. - Users can now select predefined comments directly from the list.
Using the Collect Function to Store Selections
To capture user selections, Matt uses the Collect function.
- The
OnCheckproperty of the checkbox is configured. - A collection named
colCommentsis created. - Each selected item is added to the collection.
This effectively builds a temporary dataset of user-selected comments.
Displaying Selected Comments with Concat
Matt then shows how to display the selected comments inside a form field using the Concat function.
- The comments data card is unlocked.
- The default value is replaced with a Concat formula.
- The collection is used as the data source.
- Comments are combined into a single string with separators.
This allows multiple selected comments to appear seamlessly in one input field.
Fixing Common Issues
Matt Peterson addresses several common issues that arise when working with collections:
- Checkboxes Remaining Selected
- Solution: Use the
Clearfunction in the screen’sOnVisibleproperty. - This resets the collection when the screen loads.
- Solution: Use the
- Checkbox State Not Syncing
- Solution: Use the
ThisItem in colCommentslogic in the Default property. - This ensures checkboxes reflect the actual collection state.
- Solution: Use the
- Unchecked Items Not Removed
- Solution: Use the
Removefunction in theOnUncheckproperty. - This removes specific items from the collection when deselected.
- Solution: Use the
Final Result and Benefits
By the end of the demonstration, Matt successfully creates a fully functional system where users can:
- Select predefined comments using checkboxes
- Automatically populate form fields
- Reset selections for new entries
- Dynamically add or remove comments
Matt compares this process to a “shopping cart” experience, where users pick items and submit them all at once.
Conclusion
Matt Peterson highlights how collections can significantly improve usability in Power Apps. By reducing manual input and enabling quick selections, developers can create more efficient and intuitive applications. He encourages viewers to explore more use cases for collections and continue learning through Pragmatic Works’ training resources.
Don't forget to check out the Pragmatic Works' on-demand learning platform for more insightful content and training sessions on Power Apps and other Microsoft applications. Be sure to subscribe to the Pragmatic Works YouTube channel to stay up-to-date on the latest tips and tricks.
Sign-up now and get instant access
ABOUT THE AUTHOR
Matt Peterson is a Trainer for Pragmatic Works specializing in the Power Platform. He graduated from the University of North Florida in 2006 and comes with 15 years of teaching experience in high school algebra. Matt earned the accomplishment in 2013 of being named the Florida Gifted Teacher of The Year. His primary focus is helping our customers learn the ins and outs of Power Apps and Power BI.
Free Community Plan
On-demand learning
Most Recent
- Azure Synapse Analytics: Serverless Pools [Introduction to Azure Synapse Analytics Series - Ep. 5]
- Power Apps: Working With Power Apps Collection Basics [Power Platform Series - Ep. 12]
- Microsoft Teams: Meeting Basics [Beginner to Pro Teams Series - Ep. 4]
- Azure Synapse Analytics: Azure Data Lake Configuration [Introduction to Synapse Analytics - Ep. 6]
private training

Leave a comment