Operators and Identifiers in Power Apps

Some of these operators are dependent on the language of the author. See Global apps for more information.

Symbol Type Syntax Description
. Property Selector Slider1.Value
Color.Red
Acceleration.X
Extracts a property from a table, control, signal, or enumeration. For backwards compatibility, ! may also be used.
.
[language dependent]
Decimal separator 1.23 Separator between whole and fractional parts of a number. The character depends on the language.
( ) Parentheses Filter(T, A < 10)

(1 + 2) * 3
Enforces precedence order, and groups sub-expressions in a larger expression
+ Arithmetic operators 1 + 2 Addition
-   2 - 1 Subtraction and sign
*   2 * 3 Multiplication
/   2 / 3 Division (also see the Mod function)
^   2 ^ 3 Exponentiation, equivalent to the Power function
%   20% Percentage (equivalent to "* 1/100")
= Comparison operators Price = 100 Equal to
>   Price > 100 Greater than
>=   Price >= 100 Greater than or equal to
<   Price < 100 Less than
<=   Price <= 100 Less than or equal to
<>   Price <> 100 Not equal to
& String concatenation operator "hello" & " " & "world" Makes multiple strings appear continuous
&& or And Logical operators Price < 100 && Slider1.Value = 20
or Price < 100 And Slider1.Value = 20
Logical conjunction, equivalent to the And function
|| or Or   Price < 100 || Slider1.Value = 20 or Price < 100 Or Slider1.Value = 20 Logical disjunction, equivalent to the Or function
! or Not   !(Price < 100) or Not (Price < 100) Logical negation, equivalent to the Not function
exactin Membership operators Gallery1.Selected exactin SavedItems Belonging to a collection or a table
exactin   "Windows" exactin “To display windows in the Windows operating system...” Substring test (case-sensitive)
in   Gallery1.Selected in SavedItems Belonging to a collection or a table
in   "The" in "The keyboard and the monitor..." Substring test (case-insensitive)
@ Disambiguation operator MyTable[@fieldname] Field disambiguation
@   [@MyVariable] Global disambiguation
,
[language dependent]
List separator If( X < 10, "Low", "Good" )
{ X: 12, Y: 32 }
[ 1, 2, 3 ]
Separates:
  • arguments in function calls
  • fields in a record
  • records in a table
This character depends on the language.
;
[language dependent]
Formula chaining Collect(T, A); Navigate(S1, "") Separate invocations of functions in behavior properties. The chaining operator depends on the language.
Self Self operator Self.Fill Access to properties of the current control
Parent Parent operator Parent.Fill Access to properties of a control container
ThisItem ThisItem operator ThisItem.FirstName Access to fields of a Gallery or form control

in and exactin operators

You can use the in and exactin operators to find a string in a data source, such as a collection or an imported table. The in operator identifies matches regardless of case, and the exactin operator identifies matches only if they're capitalized the same way. Here's an example:

  1. Create or import a collection named Inventory, and show it in a gallery, as the first procedure in Show images and text in a gallery describes.

  2. Set the Items property of the gallery to this formula:
    Filter(Inventory, "E" in ProductName)

    The gallery shows all products except Callisto because the name of that product is the only one that doesn't contain the letter you specified.

  3. Change the Items property of the gallery to this formula:
    Filter(Inventory, "E" exactin ProductName)

    The gallery shows only Europa because only its name contains the letter that you specified in the case that you specified.

ThisItem operator

You can show data in Gallery, Edit form, or Display form controls by binding it to a table or a collection. These controls are a container for other cards and controls. Each card or control within the container can access the bound data through the ThisItem operator.

Use the ThisItem operator to specify the column of data to be displayed in each card or control within the outer control. For example, that operator in the product gallery for Show images and text in a gallery specified that the image control showed the product design, the upper label showed the product name, and the lower label showed the number of units in stock.

For nested galleries, ThisItem refers to the innermost gallery's items. Assuming the row fields in the inner and outer galleries don't conflict, you can also use the unqualified field (column) names directly. This approach enables rules in an inner gallery to refer to an outer gallery's items.

Self and Parent operators

There are three ways to refer to a control and its properties within a formula:

Method Description
By control name Any control can be referenced by name from anywhere within the app.

For example, Label1.Fill refers to the fill property of the control who's name is Label1.
Self operator It's often convenient to reference another property of the same control when writing a formula. Instead of using an absolute reference by name, it's easier and more portable to use a relative reference to oneself. The Self operator provides that easy access to the current control.

For example, Self.Fill refers to the fill color of the current control.
Parent operator Some controls host other controls, such as the Screen and Gallery controls. The hosting control of the controls within it is called the parent. Like the Self operator, the Parent operator provides an easy relative reference to the container control.

For example, Parent.Fill refers to the fill property of the control that is the container for the current control.

Self and Parent are operators and not properties on the controls themselves. Referring to Parent.Parent, Self.Parent or Parent.Self is not supported.

Identifier names

The names of variables, data sources, columns, and other objects can contain any Unicode.

Use single quotes around a name that contains a space or other special character. Use two single quotes together to represent one single quote in the name. Names that do not contain special characters do not require single quotes.

Here are some example column names you might encounter in a table, and how they are represented in a formula:

Column name in a database Column reference in a formula
SimpleName SimpleName
NameWith123Numbers NameWith123Numbers
Name with spaces 'Name with spaces'
Name with "double" quotes 'Name with "double" quotes'
Name with 'single' quotes 'Name with ''single'' quotes'
Name with an @ at sign 'Name with an @ at sign'

Double quotes are used to designate text strings.

Display names and logical names

Some data sources such as SharePoint and Common Data Service have two different names to refer to the same table or column of data:

  • Logical name - A name that is guaranteed to be unique, does not change after being created, usually does not allow spaces or other special characters, and is not localized into different languages. As a result the name can be somewhat cryptic. These names are used by professional developers. For example cra3a_customfield. This name may also be referred to as schema name or just name.

  • Display name - A name that is user friendly and intended to be seen by end users. This name may not be unique, may change over time, may contain spaces and any Unicode character, and may be localized into different languages. Corresponding to the example above, the display name may be Custom Field with a space inbetween the words.

Since display names are easier to understand, Canvas apps will suggest them as choices and not suggest logical names. Although logical names are not suggested, they can still be used if typed in directly.

For example, imagine you have added a Custom Field to an entity in Common Data Service. A logical name will be assigned for you by the system which you can modify only when creating the field. The result would look similar to:

Accounts entity with Custom Field added, showing a display name of "Custom Field" and a logical name of "cr5e3_customfield"

When authoring a reference to a field of Accounts, the suggestion will be made to use 'Custom Field' since this is the display name. Note that the single quotes must be used because this name has a space in it:

Studio formula bar showing suggestions for field names of Accounts with the display name 'Custom Field' highlighted

After selecting the suggestion, 'Custom Field' is shown in the formula bar and the data is retrieved:

Studio formula bar showing the use of the display name 'Custom Field' for the field

Although it is not suggested, we could also use the logical name for this field. This will result in the same data being retrieved. Note that no single quotes are required since this name does not contain spaces or special characters:

Studio formula bar showing the use of the logical name cr5e3_customfield for the field

Behind the scenes, a mapping is maintained between the display names seen in formulas and the underlying logical names. Since logical names must be used to interact with the data source, this mapping is used to convert from the current display name to the logical name automatically and that is what is seen in the network traffic. This mapping is also used to convert back to logical names in order to switch into new display names, for example if a display name changes or a maker in a different language edits the app.

Note

Logical names are not translated when moving an app between environments. For Common Data Service system entity and field names this should not be a problem as logical names are consistent across environments. But any custom fields, such as cra3a_customfield in this example above, may have a different environment prefix (cra3a in this case). Display names are preferred as they can be matched against display names in the new environment.

Name disambiguation

Since display names are not unique, the same display name may appear more than once in the same entity. When this happens, the logical name will be added to the end of the display name in parenthesis for one of more of the conflicting names. Building on the example above, if there was a second field with the same display name of Custom Field with a logical name of cra3a_customfieldalt then the suggestions would show:

Studio formula bar showing the use of the logical name cr5e3_customfieldalt to disambiguate the two versions of "Custom Field"

Name disambiguation strings are added in other situations where name conflicts occur, such as the names of entities, option sets, and other Common Data Service items.

Disambiguation operator

Some functions create record scopes for accessing the fields of table while processing each record, such as Filter, AddColumns, and Sum. Field names added with the record scope override the same names from elsewhere in the app. When this happens, you can still access values from outside the record scope with the @ disambiguation operator:

  • To access values from nested record scopes, use the @ operator with the name of the table being operated upon using this pattern:
    Table[@FieldName]
  • To access global values, such as data sources, collections, and context variables, use the pattern [@ObjectName] (without a table designation).

For more information and examples, see record scopes.