web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Concatinate Array Output to String

(0) ShareShare
ReportReport
Posted on by 1,360

I need to build a string from an array.
Here is what I am trying to achieve.
The field for this particular item is Product Summary.

It holds the ID, Title and Quantity

golfnutt82_0-1674944692378.png

Those values come from Products Ordered list.

I convert the ID integer to a string. Then I use a filter query to only get the product orders where the OrderID is eq to the value in Get String Out compose action.

golfnutt82_1-1674944920127.png

From the array I need the four values concatinated as shown in the beginning

golfnutt82_2-1674945307452.png

There could be 1 or more product orders for an OrderID

 

golfnutt82_3-1674945457601.png

When I do a join I get this mess.

golfnutt82_4-1674945615778.png

 

Any direction is appreciated

 

 

 

I have the same question (1)
  • grantjenkins Profile Picture
    11,059 Moderator on at
    Re: Concatinate Array Output to String

    From looking at what you're trying to do, I would suggest building up the items within a Select, Joining the Select output, then sending in email (assuming you want to send via email).

     

    See full flow below. I'll go into each of the actions. Note that I didn't include the filtering on the items from the SharePoint List - I just added four items as an example.

    grantjenkins_0-1674977133025.png

     

    Get items retrieves the items from my list.

    grantjenkins_1-1674977159432.png

     

    Select uses the output (value) from Get items, and concatenates the items as per your requirement. Note that Map is set to Text mode (see screenshot below). The expression used to concatenate the items is below.

    concat('Id: ', item()?['ID'], ' - Title: ', item()?['Title'], ' - Quantity: ', item()?['QTY'])

    grantjenkins_2-1674977286497.png

     

    Join then takes the output from the Select and joins each item with a <br> tag so they wrap onto a new line in the email.

    grantjenkins_3-1674977304924.png

     

    Send an email includes the output from Join.

    grantjenkins_4-1674977339855.png

     

    And the email received.

    grantjenkins_6-1674977427848.png


    ----------------------------------------------------------------------
    If I've answered your question, please mark the post as Solved.
    If you like my response, please consider giving it a Thumbs Up.

  • grantjenkins Profile Picture
    11,059 Moderator on at
    Re: Concatinate Array Output to String

    So, I was thinking, and thought that maybe a better option would be to use an HTML table. Not sure if this is actually what you're looking for, but thought I'd build a sample anyway just in case 🙂

     

    See full flow below. I'll go into each of the actions.

    grantjenkins_7-1674977862630.png

     

    Get items retrieves the items from my list.

    grantjenkins_8-1674977879642.png

     

    Create HTML table uses the output (value) from Get items and maps out each of the fields you want to display in your table. You can add whatever fields you want to display here.

    grantjenkins_9-1674977926298.png

     

    Compose HTML Style adds some CSS so the table looks a bit nicer in the email. The CSS used is:

    <style>
     table {
     border-collapse: collapse;
     }
     table td,
     table th {
     border: 1px solid #ddd;
     padding: 6px 20px;
     text-align: left;
     }
     table th {
     background-color: #1C6EA4;
     color: white;
     }
    </style>

    grantjenkins_10-1674977992547.png

     

    Send an email includes the output from both Compose Table Style and Create HTML table.

    grantjenkins_11-1674978034177.png

     

    And the email received.

    grantjenkins_12-1674978494541.png


    ----------------------------------------------------------------------
    If I've answered your question, please mark the post as Solved.
    If you like my response, please consider giving it a Thumbs Up.

  • golfnutt82 Profile Picture
    1,360 on at
    Re: Concatinate Array Output to String

    Hello Grant, 
    This is great information and will definately use this when emailing the person who submitted the order.
    When I created an Update Item action and attempted to paste the Join in the Order Summary field it doesnt format the same as the output in the email. 
    Here is what it looks like:

    golfnutt82_5-1675022763077.png

    Do you know if there is a way to format this the way I need it and remove the break tags?
    I found this Solved: Formatting for a compose output - Power Platform Community (microsoft.com)
    But that looks like over kill.
    What are your thoughts?

  • grantjenkins Profile Picture
    11,059 Moderator on at
    Re: Concatinate Array Output to String

    Directly after the Select from before that concatenated the data, you can add your Update item and use the following expression to join the lines separated with a new line character.

     

    //Note that decodeUriComponent('%0A') refers to a new line character
    
    join(body('Select'), decodeUriComponent('%0A'))

     

    grantjenkins_0-1675036331866.png

     

    This would give you the following output in your list item.

    grantjenkins_1-1675036399379.png

     

  • Verified answer
    grantjenkins Profile Picture
    11,059 Moderator on at
    Re: Concatinate Array Output to String

    The solution in that link (below) you provided was crazy. They could have achieved the same result in 2-3 actions 🙃

     

    Solved: Formatting for a compose output - Power Platform Community (microsoft.com)

     

    If you're interested, this is how I would have written the flow to get what they were after. Full flow below.

    grantjenkins_0-1675038598531.png

     

    List group members retrieves the members from the group specified.

    grantjenkins_1-1675038634057.png

     

    Select user the output from List group members and maps the concatenation of relevant properties. The expression used is:

    concat(item()?['displayName'], ' - ', item()?['jobTitle'])

    grantjenkins_2-1675038745449.png

     

    Join then joins each of the items with a new line character. Join with uses the following expression for new line.

    decodeUriComponent('%0A')

    grantjenkins_3-1675038758742.png

     

    Running the flow, we get the following output.

    grantjenkins_4-1675038823909.png

     

  • golfnutt82 Profile Picture
    1,360 on at
    Re: Concatinate Array Output to String

    Hi Grant,
    Yep, with your help I was able to use the following.

    From my Get Items action I used your concat function.
    I then passed that to a Join and used a "-" delimiter.
    I then passed the output of the Join to a variable wich I used the the Order Summary field.

    golfnutt82_0-1675077308883.png

    I passed the results from the Append to string variable to an Update Item action and get the following.

    golfnutt82_1-1675077542391.png

    Thank you again for your help.
    I will use your solution when I need to show the data in an email.

     

  • golfnutt82 Profile Picture
    1,360 on at
    Re: Concatinate Array Output to String

    Just noticed the 

    decodeUriComponent('%0A')

    Im going to see how this works with my join to get rid of the hyphen.


    5 minutes later...
    It worked great, thank you!

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 691 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 431 Moderator

#3
developerAJ Profile Picture

developerAJ 266

Last 30 days Overall leaderboard