Concat And Concatenate Functions In PowerApps

In this blog, we will see how concat and concatenate functions are different in PowerApps.

If you are asked to store data from a table into one column in SharePoint or SQL DB, how would you do that?
 

Concat()

 
If you have a gallery or data table control in PowerApps which is bound to a collection:
 
Concat And Concatenate Functions In PowerApps 
 
Now, you want to store this data in one column in SharePoint or in SQL. You need to combine this data into one string like below, right? How to do this with one-line code in PowerApps.
 
1;T1;1000;1;1000|2;T2;2000;2;4000|3;T3;3000;3;9000|4;T4;4000;4;16000|5;T5;5000;5;25000|6;T6;6000;6;36000|
 
You can do this with Concat function easily.
 
Syntax of concat function
 
Concat(Table, Formula)
 
Here a table can be anything like collection, Gallery.items, SP list data source, multiselected person and group field, or multi-selected choice field. And you need to create a concatenated string of value of column/item from these data sources --  then using Concat function is the only option.
 
In the formula, you can perform any of the string operations. In this example, we will be concatenating text from all rows and columns of a Gallery using concatenate inside Concat function.
 
Concat And Concatenate Functions In PowerApps
  1. Set(AllItemsString, Concat(GalleryRepeatingTable.AllItems, Concatenate(ItemSerialNumber.Text, ";", ItemName.Text, ";" ,ItemUnitCost.Text, ";", ItemQuantity.Text, ";", ItemTotalCost.Text,"|")))  
This is the gallery control with its item template controls inside, which I have used in the above example.
 
Concat And Concatenate Functions In PowerApps
 

Concatenate()

 
We have already seen in the above example how concatenate can be used to combine/joint multiple string values into one.
 
Syntax of Concatenate function,
Concatenate(String1 [, String2, ...] )
 
It returns concatenated string.
 
Example
 
If you want to combine two three field values and save it as the title of that record, you can use concatenate as shown below:
  1. Concatenate(TextBox1.Text, " ", TextBox2.Text, " ", TextBox3.Text)  
Hope this helps you to understand the difference between these two functions.