Introduction.
I used to touch Office365 PowerApps.
PowerApps is a rather obscure tool, and I had neglected it, thinking that I would forget how to use it if I didn't write down how to use it.
I haven't touched the application in a while to fix it, and as I thought, I forgot all about it, so this time, I'll make a note of how to use it, focusing on the parts I got stuck on so I don't have to worry about forgetting it again anytime soon.
Because of the volume, the article has been divided into the following three sections, and this article is the third.
Part 1: Basics
Microsoft (Office365) PowerApps Usage Memo.
No. 2: Data-related
Microsoft (Office365) PowerApps Usage Memo (Data Sources and Collections)
No. 3: Other notes
Microsoft (Office365) PowerApps Usage Notes (Other)"
Function memo
A function reference is provided below, but it is not categorized, so we have focused on the most frequently used functions.
https://docs.microsoft.com/ja-jp/powerapps/maker/canvas-apps/formula-reference
operator
Functions and Operators | supplementary explanation |
---|---|
=、<、<=、>、>=、<> | Note that there is no "! Note that there is no "=". |
&&、||、! | ! When using "! (a)" with parentheses. |
IsBlank(<値>) | Null value, empty string check |
Text
function | supplementary explanation |
---|---|
Char(\ |
10->new line, 22->"", 39->'" |
Concatenate(\ |
String concatenation, note that it is not Concat() |
IsMatch() | Match Determination by Regular Expression |
Match() | Get match string by regular expression |
Text(\ |
Format output of date |
variable
function | supplementary explanation |
---|---|
Set({\ |
global variable set |
UpdateContext({\ |
Context (local variable) set |
ClearCollect(\ |
Collection (global array) set |
Collect(\ |
Add record to collection |
Clear(\ |
Collection Deletion |
To set multiple records in a collection at the same time, use the ``Table()`` function to summarize them
ClearCollect(<array name>, Table({<item name1>:<item value1>, ...}, {<item name1>:<item value1>, ...}, ...))
screen transition
function | supplementary explanation |
---|---|
Navigate(\ |
screen shift |
Back(\ |
return |
Exit() | Application termination (application termination is immediately transmitted to Office365) |
form
function | supplementary explanation |
---|---|
EditForm(\ | Initialize the form in edit mode |
NewForm(\ | Initialize the form in new mode |
SubmitForm(\ | Update dataset with form data. Edit or new is determined by initialization mode. |
Data Source
function | supplementary explanation |
---|---|
Refresh("Data Source") | Reload the data source |
Collect("Data Source", {"Item Name 1": "Item Value 1", ...}) | Adding records to the data source |
RemoveIf("data source", condition 1, condition 2, ...) | Delete records from the data source that match the criteria |
Remove("data source", "record to be removed", All) | Delete the specified record from the data source |
CountRows("Table") | Count the number of rows in a table (data source or object array such as a collection) |
SortByColumns("data source", "column name") | Sort by column name |
Filter("Table", "Condition 1", ...) | Retrieve records that match the condition |
LookUp("Table", "Condition 1", ...) | Retrieve the first record that matches the condition (another way to write First(Filter())) |
First("Table") | Retrieve the first record from the table data |
Tips
Where to initialize variables? How do we initialize them during debugging?
Variables are initialized when the application starts "App->OnStart" or when each page is displayed "\
However, when an app is opened in "Preview App", "App->OnStart" is not called, nor is "\
So, as shown in the example below, to initialize variables in the "Preview App", in addition to the above, a dedicated button for debugging is provided to directly execute the initialization code.
Changing the value of one component should also change the values of other components
Example: Checking a checkbox makes the text box editable.
Make the "DisplayMode" property of the text box change its setting value depending on the value of the check box.
IF(Checkbox1.Value=true, DispalyMode.Edit, DispalyMode.Disabled)
Change the properties of the side that changes the value (the text box) from the side that changes the value (the check box).Instead of, Go from the property of the side that changes value (text box) to the property of the side that changes value (check box)is the key point.
When the value of the side that changes value (checkbox) changes, the value of the side that changes value (textbox)A redraw occurs andIf the property isDynamically updated。
Allow pressing a button to change the value of other components
Example: Pressing a button causes the value in the text box to be reflected in the label.
Press the button to update the context (local variable) with the value of the text box
Change the OnSelect
property of the button to UpdateContext({output:TextInput2.Text})
Make the label's Text
property a context (local variable)
Cannot directly change the property of the side (label) whose value is changed from the side (button) whose value is changed.Because of the,Contexts (local variables) are interspersedis the key point.
Initialization is done by "OnVisible" on the screen. (Note, however, that "OnVisible" is not executed if the screen is opened from that screen in a test run of the editor.
impressions
I wanted systematic information about PowerApps, so I read the following book.
There are few options for PowerApps books, but I think this book will suffice, as it starts from scratch and covers all the necessary functions.
PowerApps is a unique specification, but there is not much information online, and considering the time and effort required to find it, I wondered if it would not be efficient to learn only from online documentation.
Microsoft seems to want to sell the "non-coding" aspect of PowerApps, but because of this, the coding style of pushing functions into properties was difficult to grasp and inflexible, and there were fewer things that could be done than I had imagined.
I will probably continue to use PowerApps because I sometimes want a UI with Office365 on the web, but honestly, I have a feeling that PowerApps will not be a major player in the future, so I will just keep a reminder that I can look back on anytime and not make a very elaborate app. I have decided not to make a very elaborate application.
I hope it will be possible to write scripts on Office365, like Google Apps Script. I have my own fantasy that this will happen in the future.