Concat and Concatenate functions in PowerApps

Concatenates individual strings of text and strings in tables.

Description

The Concatenate function concatenates a mix of individual strings and a single-column table of strings. When you use this function with individual strings, it's equivalent to using the & operator.

The Concat function concatenates the result of a formula applied across all the records of a table, resulting in a single string. Use this function to summarize the strings of a table, just as the Sum function does for numbers.

Fields of the record currently being processed are available within the formula. You simply reference them by name as you would any other value. You can also reference control properties and other values from throughout your app. For more details, see the examples below and working with record scope.

Use the Split or MatchAll function to split a string into a table of substrings.

Syntax

Concat( Table, Formula )

  • Table - Required. Table to operate on.
  • Formula - Required. Formula to apply across the records of the table.

Concatenate( String1 [, String2, ...] )

  • String(s) - Required. Mix of individual strings or a single-column table of strings.

Examples

The examples in this section use these global variables:

  • FirstName = "Jane"
  • LastName = "Doe"
  • Products = Table with two columns and four rows

To create these global variables in an app, insert a Button control, and set its OnSelect property to this formula:

Set( FirstName, "Jane" ); Set( LastName, "Doe" );
Set( Products,
    Table(
        { Name: "Violin", Type: "String" },
        { Name: "Cello", Type: "String" },
        { Name: "Trumpet", Type: "Wind" }
    )
)

Select the button (by clicking it while you hold down the Alt key).

Concatenate function and the & operator

For these examples, set the Text property of a Label control to a formula from the first column of the next table.

Formula Description Result
Concatenate( LastName, ", ", FirstName ) Concatenates the value in LastName, the string ", " (a comma followed by a space), and the value in FirstName. "Doe, Jane"
LastName & ", " & FirstName Same as the previous example except using the & operator instead of the function. "Doe, Jane"
Concatenate( FirstName, " ", LastName ) Concatenates the value in FirstName, the string " " (a single space), and the value in LastName. "Jane Doe"
FirstName & " " & LastName Same as the previous example, using the & operator instead of the function. "Jane Doe"

Concatenate with a single-column table

For this example, add a blank, vertical Gallery control, set its Items property to the formula in the next table, and then add a label in the gallery template.

Formula Description Result
Concatenate( "Name: ", Products.Name, ", Type: ", Products.Type ) For each record in the Products table, concatenates the string "Name: ", the name of the product, the string ", Type: " and the type of the product. Table of products

Concat function

For these examples, set the Text property of a label to a formula from the first column of the next table.

Formula Description Result
Concat( Products, Name & ", " ) Evaluates the expression Name & ", " for each record of Products and concatenates the results together into a single text string. "Violin, Cello, Trumpet, "
Concat( Filter( Products, Type = "String" ), Name & ", " ) Evaluates the formula Name & ", " for each record of Products that satisfies the filter Type = "String", and concatenates the results into a single text string. "Violin, Cello, "

Trimming the end

The last two examples include an extra ", " at the end of the result. The function appends a comma and a space to the Name value of every record in the table, including the last record.

In some cases, these extra characters don't matter. For example, a single-space separator doesn't appear if you show the result in a label. If you want to remove these extra characters, use the Left or Match function.

For these examples, set the Text property of a label to a formula from the first column of the next table.

Formula Description Result
Left( Concat( Products, Name & ", " ), Len( Concat( Products, Name & ", " ) ) - 2 ) Returns the result of Concat but removes the last two characters, which form the extraneous separator. "Violin, Cello, Trumpet"
Match( Concat( Products, Name & ", " ), "^(?<trim>.*), $" ).trim Returns the characters of Concat from the beginning of the text string (^) to the end ($) but doesn't include the unwanted comma and space at the end. "Violin, Cello, Trumpet"

Split and MatchAll

If you used Concat with a separator, you can reverse the operation by combining the Split and MatchAll functions.

For these examples, add a blank, vertical gallery, set its Items property to a formula in the next table, and then add a label in the gallery template.

Formula Description Result
Split( Concat( Products, Name & ", " ), ", " ) Splits the text string with the separator ", ". The string ends with a comma and space, so the last row in the result is an empty string. Table
MatchAll( Concat( Products, Name & ", " ), "[^\s,]+" ).FullMatch Splits the text string based on characters that aren't spaces or commas. This formula removes the extra comma and space at the end of the string. Table