Events
Power BI DataViz World Championships
Feb 14, 4 PM - Mar 31, 4 PM
With 4 chances to enter, you could win a conference package and make it to the LIVE Grand Finale in Las Vegas
Learn moreThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Designing a productivity application to have related data and functions in one place enables you to achieve more without having to switch back and forth between the screens. Microsoft Excel is one such example that allows editing data real time in fast and efficient way.
Using Power Apps, you can apply the same concept by providing it as a front end to any data source. You're also able to customize it even more.
This tutorial uses the following components to make a sample app:
To follow this tutorial, you'll need access to a Power Platform environment, and the ability to create tables in Microsoft Dataverse.
The tutorial uses the following structure to create the sample app:
To learn about how to add columns, see Work with table columns.
A new main form has been created to add sample data:
To learn about how to create a main form with the required columns, see Create a form. Be sure to use the correct form order for adding records using the new form.
Create a blank canvas app with the name "Catalog Management app" and Tablet layout.
This section shows how to add a Dataverse table as the data source for the sample app. You can also use an Excel file from a SharePoint site, or OneDrive as the data source; or any other data source type of your choice.
From the left-pane, select Data > Add data.
Select See all tables.
Select Editable tables, or the table that you created earlier.
For more information about adding a connection to a canvas app, see Add data source.
This step adds a form control to add new items.
Select + (Insert) > Edit form.
On the right-pane, choose the table as the data source for the edit form control.
Use the Edit fields properties option to select the columns to show on the edit form control. You can also change the column order as appropriate.
Choose the Default mode for the form to New.
Adjust the Width, Height properties for size of the data cards to fill the canvas as appropriate.
On the left-pane, select + (Insert) > Button.
Update the button text to Add product.
Select OnSelect property for the button control from the top-left side of the screen.
In the formula bar, enter the following formula.
SubmitForm(Form1);
NewForm(Form1);
This step adds a blank vertical gallery to edit the items as an editable table.
On the left-pane, select + (Insert) > Layout > Blank vertical gallery.
Select the table from Dataverse as the data source.
Resize the gallery to take over remaining half of the entire canvas since this gallery will contain all editable columns from the data source.
Select Edit gallery.
On the left-pane, select + (Insert) > Input > Text input.
Align gallery with the following actions:
At the end, you should see all rows stacked on left-side of the gallery.
Update the Default property formula for the first text input row within the gallery:
ThisItem.Product
Repeat previous steps to add a text input control for each column that you want to show up inside the app as editable field. Ensure you choose the correct columns in the formula replacing "Product" with the appropriate column names.
Tip
To resize width, use Width property, or the drag using the buttons around the first row in each column.
Select the first row from the first column inside the gallery, and add the following formula to the OnChange property with changes to column and control names as appropriate:
Patch('Editable tables',ThisItem,{Product:TextInput8.Text})
Repeat the previous step for each text input control added for rest of the columns from the connected data source. Ensure the formula is updated to use the correct column and control names.
This step adds the options to edit and cancel the edit progress. Gallery having text input controls editable by default may be subject to unintentional updates. Having an explicit edit option, and then to stop edit capability, ensures the edits are always expected.
Select Insert from the top menu > Icons, and add two icons - Edit, and Cancel (badge).
Select Tree view from the left-pane, and then select App.
Select the app OnStart property, and add the following formula with changes to gallery name as appropriate:
Gallery2.DisplayMode = "galleryDisplayMode";
Set(galleryDisplayMode, DisplayMode.Disabled);
Select the blank vertical gallery, and then select the DisplayMode property.
Update the property value from Edit
to galleryDisplayMode
. This change ensures the gallery's mode is always defined using the value of the "galleryDisplayMode" variable created in the previous step.
Update the properties and formulas for the icons as below:
Icon | Property | Formula |
---|---|---|
Edit | OnSelect | Set(galleryDisplayMode, DisplayMode.Edit) |
Edit | Visible | galleryDisplayMode = DisplayMode.Disabled |
Cancel | OnSelect | Set(galleryDisplayMode, DisplayMode.Disabled) |
Cancel | Visible | galleryDisplayMode = DisplayMode.Edit |
Overlap edit and cancel icons, since we're managing the visibility for both icons depending on the state of the gallery.
Tip
You can use the Preview button from top-right side of the screen to preview the app, or use F5 key on the keyboard. Another quick alternative for testing is to press the Alt key on the keyboard, and select the button while keeping the key pressed. This method also simulates app's preview functionality for the specific selection while key remains pressed.
As the data in the connected data source grows, it becomes difficult to find a specific row. This step adds search capability to the app to filter the gallery with searched keywords making it easier to find relevant data.
Add a text input control in the middle of the canvas, above the gallery.
Update the Items property for the gallery with the following formula instead of the table name, replacing table, and control names as appropriate.
If(IsBlank(TextInput15.Text),'Editable tables',Filter('Editable tables',(TextInput15.Text in Product) || TextInput15.Text in Segment))
.Text
syntax.Tip
You can retain older functions, or add comments, using "//" inside the formula bar. This method can be more useful for more complex formulas, or to keep older functionality in case if you'd want to revert later.
The sample app is complete with the expected functionality in this tutorial. However, extra considerations can be added—such as—the ability to reset the filter text input control, branding such as title for the gallery and app, and user profile details. You can also do more, start with Add, and configure controls in canvas apps.
The following table summarizes all the branding, profile, and reset information added to the sample app. Use the method described earlier in this article to work with different controls and properties. Ensure to replace the table, connector, and control names as appropriate.
Capability | Control | Properties | Additional information |
---|---|---|---|
App banner/label at the top of the screen | Text label | Text - "Admin Catalog Management" Font size - 28 Fill color - Blue Text alignment - Align center |
Change all values as appropriate. |
Add user display name to the top-right side of the screen | Text label | Text - Office365Users.MyProfileV2().displayName |
Connect to Microsoft 365 first by adding a connection to Office 365 Users. |
Add user profile photo on the left-side of the user display name on the top-right side of the screen | Image | Image - Office365Users.UserPhotoV2(Office365Users.MyProfileV2().userPrincipalName) |
Connect to Microsoft 365 first by adding a connection to Office 365 Users. |
Reset the search text box on the top-left corner of the screen | Icon of type "Reload" | OnSelect - Reset(TextInput15) where "TextInput15" is the text input control used as the search box. |
When selected, it will reset the search text box resulting in the gallery to display all data by default. |
Update text for Add product button | Add product button | Text - "Add new product" | Change as appropriate. |
Add a label above the gallery, on the left-side of the search input box to signify current products | Text label | Text - "Current products" Font size - 16 Font weight - Bold |
Change as appropriate. |
Add hint text for search text input box | Text input | Hint Text - "Search products or segments" | Change as appropriate, and ensure the list of fields (such as Products, Segments) aligns with the column names in your data source. |
For example, the completed screen looks like this with the controls and properties configured above:
Now that you've completed the sample app, save, publish and share the app within your organization, or with guests.
Events
Power BI DataViz World Championships
Feb 14, 4 PM - Mar 31, 4 PM
With 4 chances to enter, you could win a conference package and make it to the LIVE Grand Finale in Las Vegas
Learn moreTraining
Learning path
Create and manage canvas apps with Power Apps PL-7001 - Training
In this learning path, you practice creating and managing canvas apps with Power Apps. These skills include connecting to data sources, building screens, selecting appropriate components and adding them to screens, and publishing and sharing canvas apps. (PL-7001)
Certification
Microsoft Certified: Power Platform Functional Consultant Associate - Certifications
Demonstrate the use of Microsoft Power Platform solutions to simplify, automate, and empower business processes for organizations in the role of a Functional Consultant.