Pusťme se do toho
Začněte prosím zadáním svého pracovního nebo školního účtu.
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.
Note: This topic was written for PowerApps Studio for Windows, but the steps are similar if you open PowerApps in a browser.
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:
You can review this tutorial for general concepts only, or you can follow it exactly if you complete these steps.
Copy this data, and then paste it into an Excel file.
|Start Day||Start Time||Volunteer 1||Volunteer 2|
Format that data as a table, named Schedule, so that PowerApps can parse the information.
For more information, see Create an Excel table in a worksheet.
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:
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:
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.
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.
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.
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:
The Label control reflects your changes.
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:
In 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.
The 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:
When the user clicks or taps the arrow, the Navigate function opens the ViewScreen.
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.
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:
This step hides the Remove button when the user is creating a record.
The ChangeScreen matches this example:
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:
In the upper-right corner, click or tap the plus icon.
Set the OnSelect property of the selected icon to this formula:
When the user clicks or taps this icon, ChangeScreen appears with each field empty, so that the user can create a record more easily.
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).