Create an app from scratch
Create your own app from scratch using any one of a variety of data sources, adding more sources later if you want. Specify the appearance and behavior of each UI element so that you can optimize the result for your exact goals and workflow. This approach is much more time-intensive than generating an app automatically, but experienced app makers can build the best app for their needs.
By following this tutorial, you'll create an app that contains two screens. On one screen, users can browse through a set of records:
On the other screen, users can create a record, update one or more fields in a record, or delete an entire record:
Prerequisites
You can use your own Excel file and review this tutorial for general concepts only. However, the data in the Excel file must be formatted as a table. For more information, see Format a table in Excel.
To follow the steps below exactly, first create an Excel file using this sample data.
Copy this data, and then paste it into an Excel file.
Start Day Start Time Volunteer 1 Volunteer 2 Saturday 10am-noon Vasquez Kumashiro Saturday noon-2pm Ice Singhal Saturday 2pm-4-pm Myk Mueller Sunday 10am-noon Li Adams Sunday 10am-noon Singh Morgan Sunday 10am-noon Batye Nguyen Format that data as a table, named Schedule, so that PowerApps can parse the information.
For more information, see Format a table in Excel.
Save the file under the name eventsignup.xls, and then upload it to a cloud-storage account, such as OneDrive.
If you're new to PowerApps:
- Learn how to add a control and set its properties, which determine how the control appears and behaves.
- Learn how to add and rename a screen.
Create a blank app, and connect to data
In PowerApps Studio, click or tap New on the File menu (near the left edge of the screen).
On the Blank app tile, click or tap Phone layout.
If prompted, take the intro tour to understand the main areas of PowerApps (or click or tap Skip).
You can always take the tour later by clicking or tapping the question-mark icon near the upper-left corner of the screen and then clicking or tapping Take the intro tour.
In the left navigation bar, click or tap an icon in the upper-right corner to switch to the thumbnail view.
In the right-hand pane, click or tap Add data source.
Perform either of these steps:
- If you already have a connection to your cloud-storage account, click or tap it.
- If you don't have a connection to your cloud-storage account, click or tap Add Connection, click or tap your account type, click or tap Connect, and then (if prompted) provide your credentials.
Under Choose an Excel file, browse to eventsignup.xlsx, and then click or tap it.
Under Choose a table, select the Schedule check box, and then click or tap Connect.
The Data sources tab of the right-hand pane shows which data sources you've added to your app.
This tutorial requires only one data source, but you can add more data sources later.
Show the data
In the Home tab, click or tap New screen and then click or tap List screen.
A screen is added with several default controls, such as a search box and a Gallery control. The gallery covers the entire screen under the search box.
Click or tap anywhere in the gallery except an arrow, such as directly under the search box.
In the right-hand pane, open the Layouts list, and then click or tap the option that shows a title, a subtitle and body.
In the property list, click or tap Items, copy this formula, and paste it into the formula bar:
SortByColumns(Search(Schedule, TextSearchBox1.Text, "Volunteer_x0020_1"), "Volunteer_x0020_1", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))
If you're not sure where the property list is, see Add and configure controls.
Note
For Excel or SharePoint data sources that contain column names with spaces, PowerApps shows the spaces as "_x0020_". In this example, the column "Volunteer 1" appears in a formula as "Volunteer_x0020_1".
This gallery shows the data from the Schedule table.
A search box can filter the gallery based on text that the user types. If a user types at least one letter in the search box, the gallery shows only those records for which the Volunteer 1 field contains the text that the user typed.
The sort button can sort the records based on data in the Volunteer 1 column. If a user clicks or taps that button, the sort order toggles between ascending and descending.
That formula contains the Sort, If, IsBlank, Filter, and Text functions. For more information about these and other functions, see the formula reference
Type an i in the search box, and click or tap the sort button once (or an odd number of times).
The gallery shows these results.
More information about the Sort, Filter, and other functions
Select the Label control at the top of the screen by clicking or tapping the control.
In the property list, click or tap Text, copy this text, and then paste it in the formula bar.
"View Records"
Create the ChangeScreen and its banner
Delete Screen1, and rename Screen2 to ViewScreen.
Add a screen, and rename it ChangeScreen.
On the Insert tab, click or tap Text, and then click or tap Label.
Configure the Label control that you just added:
Set its Text property to this formula:
"Change record"Set its Fill property to this formula:
RGBA(62, 96, 170, 1).Set its Color property to this formula:
RGBA(255, 255, 255, 1)Set its Align property to Center.
Set its X property to 0.
Set its Width property to 640. The Label control reflects your changes.
Add and configure a form
On the Insert tab, click or tap Forms, and then click or tap Edit.
Move and resize the form to cover most of the screen.
The form is named Form1 by default unless you already added and removed a form. In that case, rename the form to Form1.
Set DataSource property of Form1 to Schedule.
Set the Item property of Form1 to this expression:
BrowseGallery1.SelectedIn the right-hand pane, click or tap the checkbox for each field to show it.
Near the bottom of the form, click or tap Add a custom card.
Add a Label control in the new card.
Set the AutoHeight property of the new control to true, and set its Text property to this formula:
Form1.ErrorThe label will show any errors from the form.
In the left navigation bar, click or tap the thumbnail for the ChangeScreen to select it.
On the Insert tab, click or tap Icons, click or tap the option to add a Back arrow, and then move the arrow to the lower-left corner of the screen.
Set the arrow's OnSelect property to this formula:
ResetForm(Form1);Navigate(ViewScreen,ScreenTransition.None)
When the user clicks or taps the arrow, the Navigate function opens the ViewScreen.
Add a Button control under the form, and set the button's Text property to "Save".
Set the OnSelect property of the button to this formula::
SubmitForm(Form1); If(Form1.ErrorKind = ErrorKind.None, Navigate(ViewScreen, ScreenTransition.None))
When the user clicks or taps the button, the SubmitForm function saves any changes to the data source, and the ViewScreen reappears.
At the bottom of the screen, add another button, set its Text property to "Remove", and set its OnSelect property to this formula:
Remove(Schedule,BrowseGallery1.Selected);
If(IsEmpty(Errors(Schedule)),Navigate(ViewScreen,ScreenTransition.None))When the user clicks or taps this button, the Remove function removes the record, and the ViewScreen reappears.
Set the Visible property of the Remove button to this formula:
Form1.Mode=FormMode.EditThis step hides the Remove button when the user is creating a record.
The ChangeScreen matches this example:
Set navigation from ViewScreen
In the left navigation bar, click or tap the thumbnail for the ViewScreen.
Click or tap the Next arrow for the first record in the gallery.
Set the OnSelect property of that arrow to this formula:
Navigate(ChangeScreen,ScreenTransition.None)
In the upper-right corner, click or tap the plus icon.
Set the OnSelect property of the selected icon to this formula:
NewForm(Form1);Navigate(ChangeScreen,ScreenTransition.None)`
When the user clicks or taps this icon, ChangeScreen appears with each field empty, so that the user can create a record more easily.
Run the app
As you customize the app, test your changes by running the app in Preview mode, as the steps in this section describe.
In the left navigation bar, click or tap the top thumbnail to select the ViewScreen.
Open Preview mode by pressing F5 (or clicking or tapping the Preview icon near the upper-right corner).
Click or tap the Next arrow for a record to show details about that record.
On the ChangeScreen, change the information in one or more fields, and then save your changes by clicking or tapping Save, or remove the record by clicking or tapping Remove.
Close Preview mode by pressing Esc (or by clicking or tapping the close icon under the title bar).
Next steps
- Press Ctrl-S to save your app in the cloud so that you can run it from other devices.
- Share the app so that other people can run it.
- Learn more about galleries, forms, and formulas.