Setting-a-variable-to-Self.Text_-1

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.

Self Example

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.

Parent, Self and ThisItem in Power Apps Microsoft Office 365 Setting a variable to Self.Text 2

In a similar way I can use Self with Icons and any other controls.

Parent, Self and ThisItem in Power Apps Microsoft Office 365 image 2

Parent property

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.

Parent, Self and ThisItem in Power Apps Microsoft Office 365 image 3

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.

Parent, Self and ThisItem in Power Apps Microsoft Office 365 image 4

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.

Parent, Self and ThisItem in Power Apps Microsoft Office 365 image 6

Where Self and Parent were returning Controls, this this item is giving us the records from the data source.

By Pieter Veenstra

Business Applications and Office Apps & Services Microsoft MVP working as a Microsoft Productivity Principal Consultant at HybrIT Services. You can contact me using contact@veenstra.me.uk.

2 thoughts on “Parent, Self and ThisItem in Power Apps”
  1. Is there a way that I can get a control name, something like Self.Name for Text Input, Label, combo box etc.? Thanks.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.