Share via


Difference between Concat and Concatenate Functions in Power Apps

  • Introduction
  • Concatenate
  • Concat
  • Concat and Concatenate better together
  • Summary

 

Introduction

Concatenate and Concat are two handy functions in Power App that helps us work with Strings. Though both may sound similar, they have different purposes and functionality.

Concatenate is used to combine a list of strings or a single column table into a single. It do not have to capability to work with complex data structures.

On the other hand, Concat can be used to work with tabled and combine the values in one of the columns into a delimited single string. We can also use additional Functions like fiter to get trimmed down subset of the data while combining the table data.

In this article we will see the usage of both Concat and Concatenate function with some examples

Concatenate

Concatenate function provides the same functionality as combining strings using the & operator. Usage of a delimited is not mandatory, but if needed, based on the requirement we can add a delimiter like comma to add more readability. Here we have concatenated 4 strings together without using any delimiter as we want to club together First Name, Last Name, City and Country.

This is equivalent to the combining of strings using the & Operator

Concat

Now let’s try to step to the next level of concatenation where we will try to combine the rows from a table into a string. This time we will make a connection to SharePoint list and returns the data which we will store in a collection. The SP List has the below schema and data

We will store it into a collection using the formula

Collect(ListItems,ShowColumns('Travel Procurement List',"ProcurementItem","ProcurementDate","Cost_x0028_USD_x0029_"));

Now lets see how we can use Concat function to combine the Procurement Item colum values as a comma separated value in a text box control

Concat('Travel Procurement List','Procurement Item'& ",")

Here we are using the Concat function to combine the values in the procurement items column and separating them with a comma and assigning it to the text box value

We can further apply filtering to show only those items whose cost is above 200 USD using the filter function in the expression

Concat(Filter('Travel Procurement List','Cost(USD)'>200),'Procurement Item'& ",")

Same way, when we are working with Concat function to combine and return unique values from SharePoint List, we can use Distinct function to combine and remove the duplicates.

Concat(Distinct('Travel Procurement List',Department),Result&" ,")

Here we are applying Distinct and the output of the function is present in the variable Result which is then concatenated with a comma

Concat and Concatenate better together

 

So far, we saw how to combine the values of a single column in a table together. Now lets see how we can combine the values from 2 columns together. Say for instance we want to Combine the Procured Item Name and Date together. We will use the Concatenate to stitch together the columns and Concat to combine the row values using the expression

Concat('Travel Procurement List',Concatenate('Procurement Item'& "("&'Procurement Date'&"), "))

Summary

Thus, we saw at a high level how to get started with Concat and Concatenate and also how to use them both together.