Concat, Concatenate and Split function in Power Apps
1. Concat Function in Power Apps
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. The string is separated by the separator.
The Concat function is used to dynamically generate an HTML table to be used in the creation of a PDF document with the help of Power Automate.
Power Apps Syntax Concat( Table, Formula [, separator])
The function has the following parameters:
- Table - It is the required parameter. Table to operate on.
- Formula - It is the required parameter. Formula to apply across the records of the table.
- Separator - It is an optional parameter.
Example:Step 1: In a sharepoint list, we have a column called Email, of type Single line of text.
Step 2: Add this data source in the power apps and add a Text label control in Power Apps Studio.
Step 3: Set the following formula on the Text property of a label control.
Power Apps Formula
Evaluates the expression Email for each record of ‘Site Users’ List and concatenates the results together into a single text string separated by "; ".
Here, to refer the current record, name of the field is enough, no need to use ThisRecord.
We can use that single string that contains the values of the Email column separated by a semicolon. We can use this formula for the To: argument in the Office365.SendEmail function to send a single email to all of those addresses.
2. Split function in Power Apps
The Split function splits a text string into a table of substrings. Use the Split function to break up comma-delimited lists, dates that use a slash between date parts, to break a word into the individual characters, and in other situations where you need a well-defined delimiter.
Power Apps Syntax Split(Text, Separator)
- Text - Required. Text to split.
- Separator - Required. A separator string is used to break the text string apart. The separator can be zero, one, or more characters that are matched as a whole in the text string. The matched separator characters aren’t returned in the result. If no separator match is found, then the entire text string is returned as a single result.
Example:Step 1: In a sharepoint list, we have a column called Company, of type Single line of text.
Step 2: Add this data source in the power apps and add a Dropdown control in Power Apps Studio.
Step 3: Set the following formula on the Items property of the dropdown control.
Power Apps Formula
It is shown that the split function returns a table.
Also, in the dropdown control all values are loaded.
Step 4: Take another dropdown control, and set its Items property to the following Power Apps Formula.
Power Apps Formula
The above formula creates a single column table with three records.
The table is created with the column Value.
The values are loaded in the dropdown control.
Step 5: Add another dropdown control, and set its Items property to the following Power Apps Formula.
Power Apps Formula
Note: Using a zero length or blank separator results in each character being broken out individually.
The values are loaded in the dropdown control.
3. Concatenate functions in Power Apps
The Concatenate function is used to combine a mix of individual strings and a single-column table of strings. When we use this function with individual strings, it's equivalent to using the & operator.
Fields of the record currently being processed are available within the formula. Use the ThisRecord operator or simply reference fields by name as you would any other value. The As operator can also be used to name the record being processed which can help make your formula easier to understand and make nested records accessible. For more information, see the examples below and working with record scope. Use the Split or MatchAll function to split a string into a table of substrings.
Power Apps Syntax Concatenate( String1 [, String2, ...] )
- String(s) - It is the required parameter. Mix of individual strings or a single-column table of strings.
Example:Step 1: Add a Text label control and set its Text property of a Label control to the following formula.
Power Apps Formula
Step 2: We can achieve the same functionality using the & operator instead of Concatenate function. Add another Text label and set its Text property to the following formula.
Power Apps Formula
Step 3: Concatenate with a single-column table
Set the following formula to the Items property of the dropdown control.
Power Apps Formula
The above function returns a single column table, with a Value column.
For each record in the 'Site Users' List, concatenates the string "Email: ", the email of the 'Site Users', the string ", Company: " and the company of the 'Site Users'.