You are currently viewing How to split string in power automate to array?
How to split a string in Power Automate to array and access the array elements?

How to split string in power automate to array?

In this blog post we will learn how to split string in power automate to an array and how to access array elements in power automate.

How to split string in power automate?

In Power Automate , you can split a string into an array using the split() function.

Example: Suppose we have a flow that receive an input string with the following format text||text||text we need to split the string using the || delimiter and put it in an array

split1 | Power Platform Geeks

Use split function :In PowerApps, the Split function is used to break a text string into a table of substrings based on a specified delimiter.

Delimiter: The character or characters that define the boundaries between the substrings

Syntax:

Split(Text, Delimiter)

So in our case the delimiter is || so the code of the split function will be as shown below.

split(triggerBody()['text'],'||')
split string in power automate

The Out put will be an array of substrings, and you can use it in subsequent steps of your flow.

out | Power Platform Geeks

how to access array elements in power automate?

You can access array elements within various actions like “Compose,” “Apply to each,” or directly in dynamic content.

For example the Output of the previous compose action we can access the elements of the array using it’s index that begin with 0 for the first element, 1 for the second element and so on.

For example to retrieve the second element of the array access it with Youraction[1]

The number inside the square brackets indicates the index of the element you want to access.

output1 | Power Platform Geeks

The Output will be Heba the second element in the array

output2 | Power Platform Geeks

This is how to split string in power automate into array and access the array elements by index.

See Also
Join us

Heba Kamal

Microsoft MVP, MCT, Technical Speaker, Blogger, and Microsoft 365 and Power Platform Consultant.

This Post Has 3 Comments

  1. Puravive review amazon

    Excellent blog here Also your website loads up very fast What web host are you using Can I get your affiliate link to your host I wish my web site loaded up as quickly as yours lol

  2. metlife reviews

    aesthetically pleasing portion of the content I recently came into and I must admit that I truly enjoyed reading your blog entries. Nevertheless, I will be signing up for your updates and even I hope to receive them quickly every time.

  3. 12345

    Your commitment to quality really stands out. ❤️

Comments are closed.