Skip to content
Tutorials Center
My learning

Topics

Lesson 5 of 38 ยท Getting Started

Build Your First Canvas App

Follow a step-by-step workflow to build a simple task app in Power Apps: create the app, add a data source, a gallery, a search box and a button.

In this lesson you will build a small task list app. The steps below describe what to click and what to type. Because Power Apps runs in the cloud, you will do them in your own environment; the JavaScript stand-ins here let you test the logic first.

You need: a Microsoft account with Power Apps access (the free Developer Plan works) and about thirty minutes.

Step 1: Create the data

The simplest data source for a first app is a Dataverse table in a developer environment, or an Excel table in OneDrive. We will describe a table named Tasks with these columns:

Column Type
Title Single line of text
Owner Single line of text
Done Yes/No
Due Date

In the maker portal: Tables, then New table, name it Tasks, add the columns, save. Add three or four sample rows. (You will study tables in depth in Dataverse tables and columns.)

Step 2: Create the app

  1. Choose Create, then Blank app, then Blank canvas app.
  2. Name it Task Tracker, pick Tablet, and select Create.
  3. In Studio, open the Data pane and Add data. Choose the Tasks table.

The app now knows the data source Tasks, which you refer to by name in formulas.

A gallery shows a repeating list. From Insert, choose a Vertical gallery (or Blank vertical gallery). Set its Items property to:

TEXT
Tasks

Inside the gallery's template, labels refer to the current record as ThisItem. Set a label's Text to ThisItem.Title. Add a second label with ThisItem.Owner.

Insert a Text input and rename it txtSearch. Change the gallery's Items to:

TEXT
Search(Tasks, txtSearch.Text, "Title")

Now the gallery narrows as you type. You will meet Search and Filter again in Filter, search, sort and Patch.

The stand-in below reproduces that exact behavior with a JavaScript array, so you can see what the formula must return for different inputs.

JS Stand-in: Search(Tasks, txtSearch.Text, "Title")

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Step 5: Add a button that changes data

Insert a Button and rename it btnAdd. Set OnSelect to:

TEXT
Patch(Tasks, Defaults(Tasks), {Title: txtSearch.Text, Owner: User().FullName, Done: false});
Reset(txtSearch)

Patch with Defaults creates a new record. Reset clears the text box. Because the gallery's Items is based on Tasks, the list refreshes after the write.

To toggle the Done flag, add a checkbox in the gallery with Default set to ThisItem.Done and OnCheck/OnUncheck calling Patch(Tasks, ThisItem, {Done: true}) or false.

The next stand-in models those two actions (add and toggle) as functions over an array.

JS Stand-in: Patch to add and update records

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Step 6: Test, save and publish

  1. Press F5 to play. Type in the box, add a task, toggle a checkbox.
  2. Open App checker and fix any red items.
  3. Save, then Publish. Add a version note such as "First version".
  4. Open the app list, select your app and Run it, or Share it with a colleague. They need access to the Tasks table as well as the app.

Things that go wrong for beginners

  • Empty gallery: the data source has no rows, or Items has a typo. Check the formula bar for errors.
  • Formula error Name isn't valid: a control was renamed or deleted. Fix the reference.
  • Colleagues see no data: the app is shared but the data source is not. Share the table or list too.
  • Slow typing: filtering a huge table on every keystroke. See Delegation and data sources.

Improving the app

Ideas for practice: add a Due date column and show overdue tasks in red; add a sort toggle; add a Delete icon; show a count of open tasks in the header. You will have the tools for all of these by the end of chapter 3.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does ThisItem refer to inside a gallery template?

    A gallery repeats its template once per record, and ThisItem is the record for that row.
  2. 2. Which function creates a new record when combined with Defaults?

    Patch(Source, Defaults(Source), {...}) inserts a new record.
  3. 3. Your colleague can open the app but sees no tasks. What is a likely cause?

    Sharing an app does not automatically grant access to its data.
  4. 4. Which button sends the saved version to end users?

    Publish releases the latest saved version.

Summary

  • A first app needs a data source, a gallery, an input and a button.
  • Gallery Items takes a table or a Search/Filter expression; labels use ThisItem.
  • Patch with Defaults adds records; Patch with a record updates it.
  • Test with F5, check with App checker, then Save and Publish.
  • Share data access along with the app.

Next: Canvas apps versus model-driven apps