The Power Automate Join function and action are the counterpart to the Power Automate split function. The Join function converts a text array to one string and separates the elements of the array by a delimiter. It is undoing the split function like split is undoing a join function.
A very common use case is to use a comma or semicolon as the delimiter to generate a CSV file like separation of the elements.
In this artile you will get to know the Power Automate join function and action in detail and by examples. Furthermore you will learn how to handle common advanced scenarios with the join function.
Power Automate Join Function
The Power Automate join function returns a string that is created by the given string array by concatenating all array elements by the given delimiter.
Syntax
join([<collection>], '<delimiter>')
Input parameters
- collection (mandatory): The collection/array which elements should be joined to a string.
- delimiter (mandatory): The delimiter to separate array items of each other.
Return value
- A string containing all given collection elements separated by the given delimiter.
Power Automate Join Expression Examples
join(createArray('a','b','c'),',')
// returns "a,b,c"
join(variables('myArray'),',')
// reference variable within in join function
Power Automate Join Action
The join action in Power Automate is identical to the join function. The action is more convenient to use, since Power Automate expressions are sometimes a little fiddly to create.
Nevertheless, expression do not bloat a flow as much as actions. So in most cases, I would use the function for this reason. In small simple flows I would not care and probably use the action. In the end, it doesn’t really matter.
Let’s take a look how to use the Power Automate Join action by doing a very simple example.
How To Use Power Automate Join Action
Within this step by step guide you will learn how to use the Join action. We will join an array to a string in this simple example.
-
Create a new flow with name ‘Join Flow’ of type ‘Manually trigger a flow’
Create new instant flow
-
Add a new step by clicking on ‘+ New step’
Add a new step
-
Search for ‘initialize’ and click on ‘Initialize variable’
Add Initialize variable
-
Set Name to ‘myArray’, Type to Array and value to ‘[“apple”,”orange”,”banana”],
Setup Initialize variable action
-
Add a join action by searching for ‘join’ and click on the Join Data operation
Add Join action
-
Click in the ‘From’ text field and click on ‘myArray’ int he popup
Join action from
-
Set the Join with value to ‘,’
Join action Join with
-
Do a test run and check the result string
Result test run – Power Automate join array of strings
More Power Automate Join Examples
See more examples on how to use join in Power Automate here.
Join with newline
When you want to join a Power Automate join array with line break, you need to decode the new line with the decodeUriComponent function. See how the delimiter is set to new line in the following example.
join(variables('myArray'),decodeUriComponent('%0A'))