Simple Todo App Using Power Apps
Hi. Let's build a simple Todo application using Microsoft Power Platform with Power Apps.
First, we need to have table where we can store all the todos tasks. Then we will create a canvas app and connect the table as our data source.
Let's see, how can we create the table for the Todo Application.
Steps for table:
Step 1: Log on to https://make.powerapps.com
Step 2: On the left hand side, click on "Tables".
Step 3: Click on New table > Table (advanced properties).
Step 4: Give Display Name for your table. Let's say "Todo". On the Primary column tab, you can change Display Name to "TaskName" though this is optional. Click Save.
Step 5: Insert data in one row as a sample.
Now, let's look at how to create the UI for this and connect our table with the UI.
Steps for Canvas app:
Step 1: Goto https://make.powerapps.com
Step 2: From the left side panel, click on "Create" > Select Blank App.
Step 3: Re-create the UI from the above image.
Step 4: Click Insert > Vertical Gallery. Drag the component on the UI to your desired location.
Step 5: Select the Vertical Gallery and click on Layout and select "Title".
Step 6: Similarly, click on Data to connect it with a Data source. Search and select the name of the table you have just created.
The functionality of the `Add Task` button is to take value from the text field and insert it into the table. For this, we'll use the Patch function.
The Patch() function allows to insert, update or delete records in a data source.
The Power Fx formula to Insert Data is: Patch(MyTable, Defaults(MyTable), {ColumnName: TextInput1.Text})
Here,
- MyTable refers to the name of the data source in Plural name of your table.
- Suppose our table name is "Todo", then the plural name will become "Todos"
- Defaults(MyTable) refers to a new record in the data source.
- {ColumnName: TextInput1.Text} specifies the column name where the value from the TextInput1 will be inserted.
Step 7: Click on the button. Select `OnSelect` property and edit the PowerFx for this to:
Patch(TodoApps,Defaults(TodoApps), {Task: TextInput1.Text})
Tip: Did you know you can press Alt key while in Edit mode to preview your app, instead of clicking the Preview button?
Next, we'll learn how to make a checkbox against each task on the todo app and strike when its completed.
Comments
Post a Comment