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

Parent, Self and ThisItem in Power Apps

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 1

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

Parent, Self and ThisItem in Power Apps 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 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 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 5

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

Leave a Reply

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

%d bloggers like this: