The Concat function concatenates the result of a formula applied across all the records of a table and returns a single string.
Concat( Table, Formula, separator)
- Table – Required. Table to operate on.
- Formula – Required. Formula to apply across the records of the table.
- Separator – Optional. A text value to be inserted between concatenated rows of the table.
Examples of using Concat function in Power Apps
As you can see, here we have a gallery which contains employee’s data.
Suppose, you want to send an email to every recipient listed in gallery, then you can use the Concat function to concatenates all of the recipients’ email addresses into one single text string, each one separated by a semicolon (;) then you can pass that text string to send email formula.
Let’s add a Text label control, go to Insert tab and select Text label control.
Now, set the Text property of Text label control to formula as shown below.
Concat( gal_employee.AllItems, Email, ";" )
You can see the output, it returns a single text string concatenating all the email addresses together separated by semicolon.
Let’s understand the above formula, it evaluates the expression Email for each items of gallery and concatenates the result together into a single text string separated by semicolon (;).
Now, you can pass this single text string which consists all email addresses to send email formula as shown below.
[Read: Send an email from Power Apps]
Office365Outlook.SendEmailV2( Concat( gal_employee.AllItems, Email, ";" ), "Test email", "Sending email to all recipients" )
In case, if you want to concatenates particular items then you can filter the data using Filter function.
Let’s concatenates those email addresses which belongs to country India.
Concat( Filter( gal_employee.AllItems, Country = "India" ), Email, ";" )
You can see, the output in Text label control. It concatenates only those email addresses which belongs to country India.
Also Read..
Email validation in Power Apps
Highlight selected item in gallery
Gallery control : Design a gallery in Power Apps
Add Alternate background color to rows
Sort Items in gallery Power Apps