Exercise - Modify a view in a model-driven app

Completed

Previously, you learned that by using the related action, you can view the accidents that an employee has been involved in. In this section, you'll learn how to modify that view to add more details about the accident. As a result, users can view the accident details without having to select each accident individually.

Screenshot of the AccidentTable Associated View.

The preceding image shows that even though we started from the Employees view, we could select the related table (AccidentTable) to see the view called AccidentTable Associated View. We can modify a view to add more details about the accident. In this exercise, we'll modify the view to resemble the image above.

  1. Go to Tables in Power Apps.

  2. Find the AccidentTable in the list of tables.

  3. Select Views and then find and select AccidentTable Associate View to open it the designer studio.

  4. In the Table columns designer, ensure that these fields are added or already in the view from your AccidentTable to see details of the event in the view (remember you can drag and drop to adjust the order):

    • AccidentDescription

    • AccidentDate

    • ManagerComments

    • ManagerReviewed

    • Status

  5. Now, let's add some data from related tables to the view. Switch to the related table columns by selecting the Related tab from under the Table columns panel on the left. You'll see a list of related tables with the matching column to your current table, followed by the table name in parenthesis. You can expand/contract these for the available fields by selecting the name of the relationship. For our view, add the following fields:

    • LocationName from the LocationTable

    • AccidentName from the TypeofAccidentTable

    • AccidentSeverity from the TypeofAccidentTable

  6. Select Save and Publish to complete the modification. When you publish this view, the apps using this view will automatically update.

  7. Return to your Accident Tracking Application.

  8. Go to Employees and then select the Renata Hall record.

  9. Select Related > AccidentTables.

    The view that you updated should now be visible. You can modify any view in your app by the view's name. Go to your table, select views, find/select the view, make your changes, and then save and publish the view.

This exercise demonstrates that, after you update/publish a view, the results will be shown automatically in your model-driven app.