Skip to main content

Notifications

Community site session details

Community site session details

Session Id : GDHAVPfte1Td5WxVLUwYIz
Power Automate - Building Flows
Answered

How do you split items inside an array?

Like (1) ShareShare
ReportReport
Posted on 6 May 2020 22:03:19 by 62

Hi

I have a single string which I need to split two times.

I have no issues splitting it the first time like this way:

 

String: "0;1;2; | a;b;c; | A;B;C; |"


Action: Initiate Variable 

Name: varArray

Type: Array

 

Action: Set Variable

Input: varArray

Value: split('string','|')

 

Output:

[
  [
    "0;4;Premium SSD;",
    "1;4;Premium SSD;",
    "2;4;Premium SSD;",
    "3;4;Premium SSD;",
    ""
  ]
]
 
 
 
Now, how do I further split each item of the array, producing an array of arrays?
 
 

 

  • Jorn75 Profile Picture
    4 on 27 Dec 2022 at 00:05:03
    Re: How do you split items inside an array?

    Hi @v-bacao-msft 

    I'm just wondering how the flow should look after apply to each if I want to add these text to a mail. How can I append these text in a mail (or an approval flow).  

     

    Best regards Jorn

     

    Best regards Jorn

  • Mlimacher Profile Picture
    3 on 03 Mar 2021 at 08:14:10
    Re: How do you split items inside an array?

    Nice and simple 👍

  • v-bacao-msft Profile Picture
    on 08 May 2020 at 04:20:43
    Re: How do you split items inside an array?

     

    Hi @Morke ,

     

    The Split() function will return an array. We generally use Apply to each to traverse the elements in the array, and the items() function is used to get the elements of each traversal.

     

    If the element is an object, then we can get the property value through items()[‘PropertyName’].

     

    You can use Apply to each to get each element and apply it to other actions, but the action must also be configured in Apply to each.

     

    In addition, since the return value is an array, we can use index to get the value of each element. Like: You can get the value of the first element in the array through split ('string', '|') [0].

     

    For more details, please refer to WDL function:

     

    By doing more tests, we can easily master Data operations in Power Automate.

     

    Best Regards,

  • Morke Profile Picture
    62 on 07 May 2020 at 13:53:11
    Re: How do you split items inside an array?

    Thank you for the help. This works.

    I have a doubt, what's the reference to "items()"? I want to understand how it works.

    Also:
    How can I use all the resulting split strings? I mean how do I use them as objects further down in the flow after this split? What's the reference to them?

  • Verified answer
    v-bacao-msft Profile Picture
    on 07 May 2020 at 01:56:05
    Re: How do you split items inside an array?

     

    Hi @Morke ,

     

    Please check the following configuration and see if it helps:

    163.PNG

    We could use items('Apply_to_each') to get the item of the array and continue to use split() function to handle it.

    Hope this helps.

     

    Best Regards,

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,745 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,091 Most Valuable Professional

Leaderboard