How to Merge Strings with Power Apps Concatenate Function

The Concatenate function in Power Apps is used to merge multiple strings into a single string.

This is particularly useful when you want to combine text from different sources such as labels, text inputs, or even data from tables.

Syntax

The basic syntax of the Concatenate function is:

Concatenate(String1, String2, String3, ...)

Each string is separated by a comma, and you can include as many strings as needed.

Examples

1. Concatenating Simple Strings

Concatenate("Julie", " ", "Johnson")

This will output: Julie Johnson. Notice the space added as a separate string to ensure proper formatting.

2. Using the Ampersand (&)

Instead of Concatenate, you can also use the ampersand (&) operator:

"Julie" & " " & "Johnson"

This produces the same result: Julie Johnson.

3. Concatenating with User Information

Concatenate("Hello ", User().FullName, " Welcome!")

This example greets the currently logged-in user by combining static text with dynamic user data.

4. Concatenating Text Input Controls

Suppose you have two text input controls (TextInput1 and TextInput2):

Concatenate(TextInput1.Text, " ", TextInput2.Text)

If TextInput1 contains Keith and TextInput2 contains Johnson, the result will be Keith Johnson.

5. Concatenating Data from a Table

You can also concatenate values from a table connected to a gallery. For example, if you have a SharePoint list of products:

Concatenate(Gallery2.Selected.Product, " Price is ", Gallery2.Selected.Price)

If the selected product is Notebook with a price of 1000, the result will be: Notebook Price is 1000.

Concatenate vs Concat

It is important to distinguish between Concatenate and Concat:

  • Concatenate: Combines multiple strings into one.
  • Concat: Iterates through a table and concatenates values from each row into a single string.

For example, if you have a table with five rows, Concat can merge data from all rows into one continuous string.

Conclusion

The Concatenate function is a versatile tool in Power Apps that allows you to merge text from different sources. Concatenate helps you create dynamic and meaningful text outputs in your applications by combining static strings, user data, text input values or table records.

Comments

Leave a Comment

Your email address will not be published. Required fields are marked *