With lasts week’s new Self feature in Power Apps, I thought that it would be useful to have a look at Self, Parent and ThisItem.
First of all Self, Parent and ThisItem are not functions, They are more like properties within the current context. Within Power Apps these are called Named operators.
You can recognize these properties as they don’t have () that include properties.
I will start with an example of Self. When I click a button the text of the button. This is then displayed in a label.
All the properties of the button are available through the Self operator.
In a similar way I can use Self with Icons and any other controls.
Similar to Self I can use Parent to refer to the parent control of the current control. So in the example below I’m using the parent operator to get to the properties of the Screen that the button is part of.
When buttons are part of galleries for example Parent will refer to the gallery that it is part of.
As shown below I can use parent.selected to make a button inside the gallery find the selected item in the gallery.
ThisItem in Galleries
ThisItem is the 3rd of the operators that I’m going to look at in this post. ThisItem refers to the current data structure within the gallery. Noticed that this isn’t the item that is selected.
For each section in your gallery the ThisItem refers to a different record.
Where Self and Parent were returning Controls, this this item is giving us the records from the data source.