Next Gen Data Learning – Amplify Your Skills

Blog Home

Blog

Microsoft Flow String Functions: Concat And Replace

by | Power BI

Learning how to combine two or more strings is essential in creating MS flows. In this tutorial, we’ll discuss two of the most important Microsoft flow string functions – concat and replace.

The concat function simply combines two or more strings together and returns the combined string, while the replace function replaces a substring with another string.

For our example, we’ll be using this simple flow that I previously created. First, let’s add another Text input.

Microsoft Flow String Functions

Then rename it as Input 2 and the other one as Input 1.

Microsoft Flow String Functions

After that, we’ll add a new step.

Microsoft Flow String Functions

Search and select the Slack connector.

Microsoft Flow String Functions

Then choose the Post message action.

Microsoft Flow String Functions

We’ll post it in the discord channel on Slack.

Microsoft Flow String Functions

Microsoft Flow String Functions: Concat

For the Message text, let’s use the concat function under the Expressions tab.

Microsoft Flow String Functions

Choose Input 1 and Input 2 as the two strings that we’re going to combine. Make sure to put a comma after choosing Input 1.

Microsoft Flow String Functions

Then click the OK button.

Microsoft Flow String Functions

Lastly, click Save.

Microsoft Flow String Functions

Testing The Concat Function

Let’s now test if the concat function will work. Click Test.

Microsoft Flow String Functions

We’ll perform the trigger action and click the Test button.

Microsoft Flow String Functions

Enter the following details for the inputs, then click Run flow.

Microsoft Flow String Functions

As we check our discord channel in Slack, we’ll see the newly-posted message which is the concatenated version of our inputs for Input 1 and Input 2.

We can also concatenate multiple strings together. For example, let’s go back and edit our flow. Click the function for our Message text then add a space that should be enclosed with a pair of single quotation marks. Then click Update.

Let’s test the flow again.

We’ll just use the data from our previous run. Then click Save & Test.

Upon checking in Slack, we can now see that there’s a space in between the two data entries.

And that’s how simple the concat function works. 

Microsoft Flow String Functions: Replace

Let’s now try and understand how the replace function works. Let’s go back and edit our current flow. We’ll replace the first input (Henry) with something else. Under the Expressions tab for our Message text, choose the replace function.

We’ll put the whole concat expression inside the replace function. Put a comma right after the concat expression, then type in the old text that we need to replace. In our case, we’ll replace “Henry”. After that, add another comma and type the new word that we’ll use as a replacement (“Fred”). Then click Update.

Let’s delete the initial expression that we created.

Lastly, click Save.

Testing The Replace Function

Let’s test our flow again. This time, we’ll check if the replace function worked properly.

Let’s just use the data from our previous runs, then click Test.

Let’s go back to the discord channel in Slack. Upon checking, the displayed message is now “Fred Legge”. That means we’ve successfully replaced the initial input that we entered which is “Henry”.

***** Related Links *****
Power Automate Expressions – An Introduction
Power Automate Environment: Setup And Overview
Workflow Inputs In Microsoft Power Automate

Conclusion

To summarize, the concat function simply concatenates two strings together, while the replace function changes the string based on the specified text in the parameter. We can also make the replace function dynamic by using variables for the parameters. For instance, we can use the second input to replace the first input and vice versa.

Hopefully, you were able to understand the usage and importance of these two commonly used Microsoft flow string functions.

All the best,

Henry

Related Posts