Exercise

Completed

In this unit, you create a model-driven app by using one of the standard tables available in your Microsoft Power Apps environment. Before Creating a model-driven app, you must first create a Solution for your app to reside in.

Create a Solution and add an existing data table

  1. On the Power Apps home page, select Solutions (you might need to select More from the left side navigation panel, then you can find Solutions).

  2. Select New solution from the command bar.

  3. In the New solution panel that appears on the right side of your screen, input the following:

    Display name: Learning Accounts

    Publisher: [select one from the dropdown]

  4. Select the Create button at the bottom of the panel.

  5. Once your Solution appears, you see a list of Objects with a number in parenthesis for how many of each type of object is part of the solution. In the command bar, select Add existing > Table.

  6. Find and select your Account table.

  7. The screen transitions to the Selected tables, select the box Include all objects. Then select the Add button at the bottom of the screen.

After a moment, your Account table will show up as an object for your solution. You'll see the table appear in the list of objects.

Create a model-driven app

  1. Still in the Solution Objects menu, go to the command bar and select New > App > Model-driven app.

  2. Name your app "Learning Accounts" and select Create

Your new app appears in the App Designer, and you can now add components to it.

Add a page to your app

You can add pages to your app within the App Designer.

  1. Select Add Page from the command bar or from the app canvas screen.

    Screenshot of the Site Map Designer view.

  2. In the Add page popup window, select Dataverse table. Then select the Account table and the Add button.

    Note

    If Account is not an option as a table, you may not have any sample data in your environment. Refer to this exercise on how to create sample apps and data. If the sample data does not appear, refer to this documentation to add sample data.

Go ahead and Publish it (button in the top right of the command bar). Publish will automatically save/publish your app.

Edit your form

When we created the app, Power Apps automatically created forms for our app. Let's do some modification to the main form. Power Apps has navigation tabs at the far left of the screen, at this point showing Pages as the one selected, and a Pages panel just to the right of that. Your app currently has one page in it. The Navigation shows your Accounts view and, when expanded, it shows the Accounts form. All of this information shows in the Pages panel.

  1. Under Navigation select Accounts form. Your form shows on the Power Apps canvas as it shows in the app.

  2. Select Edit form.

  3. Now, there's a lot on this pre-configured form, don't be overwhelmed. Let's do a couple of simple changes, so you can see how easy it's to modify a form. Go to the Account information pane and select Ticker Symbol.

  4. Select Delete from the command bar (or your delete button from your keyboard) to remove it from the form. When you delete this item from the form, you're not deleting this column from your data, you're simply removing it from the form. If you accidentally delete a column, Power Apps has a handy Undo button in the command bar just to the right of the Back button.

  5. Look at your Table columns panel on the left side of your screen. This is a list of every column in your Accounts table. If you want to find the Ticker symbol column that we deleted, enter "ticker" in the search field.

  6. Clicking on any table column adds it to the part of the form under your cursor. Your cursor should currently be in the Account Information pane. Select Ticker symbol from your Table columns pane. Did you see how easy that is to add it back into your form?

  7. At this point, if you've made any changes you want to keep, you can select Save and publish from the top right of the command bar.

  8. Once Power Apps finishes republishing your form, select Back from the top right of the command bar to exit the form editor and return to your app editor.

Edit views

When creating this app, Power Apps made some views to go along with it. In your Navigation menu in the Pages panel, you can see any views that are already part of your app. The current view that your screen shows is the one titled Accounts view and your app screen shows the view "My Active Accounts" and has a dropdown just to the right of the title. This dropdown allows users to select another view.

  1. Select Accounts view in the Navigation list. Notice that a panel appears on the right side of the screen showing your Accounts table and a tabbed list below that, currently showing Views, and My Active Accounts showing. This is the Default view for the app.

  2. From this Views list you can edit any of these views, but let's keep it simple and modify the view for My Active Accounts. You can select Edit view from the command bar to go to the View editor.

  3. Similar to how we edited our form in the Form editor, you see a canvas in the center showing displayed columns. Let's add the State/Province to the view. Find "Address 1: State/Province" from the Table columns list (you can input "state" into the search field), and select it to add it to the view.

  4. Power Apps allows you to reposition columns easily. Let's move the Main Phone column to the far right of the view. Drag and drop it to the right of the Address 1: State/Province, column.

    Screenshot of the Site Map edit view.

  5. To save your changes, select Save and publish from the top right of the command bar.

  6. After a few moments when Power Apps is done publishing the changes, you can select the Back button from the command bar to close the View editor. Notice how you now have the State/Province on your preview canvas.

View a chart

Power Apps includes some example interactive charts with the sample data included in the Accounts table. Let's explore a sample of that.

  1. Within your preview canvas, select the Show Chart button from the app command bar.

  2. The chart panel appears below the title. By selecting the dropdown at the top of the chart panel, you can change the chart view. Try switching the view between several options including: Accounts by industry, Accounts by owner and New Accounts By Month to see a few examples.

Notice that there are different ways you can portray data within a view.

Below is an example of a system dashboard called Innovation Challenge which includes several charts to give you an idea of what's possible. If you have sample apps and data in your Dataverse environment, you can find this app in your apps list. This app includes three views and a Dashboard screen (depicted below) which shows several of the views together.

Screenshot of the innovation challenge view.

You can create a chart from any table, but that is beyond the scope of this unit.

Next, we create some security roles for the people who use this app.