Search code examples
sharepointpower-automate

Extracting just the Names from a Compose function in Power Automate


I'm new to Power Automate and my goal is to extract just Names from the result of a Compose Function. The result of the compose function is as follows,

[
  {
    "Title": "Alex"
  },
  {
    "Title": "John"
  },
  {
    "Title": "Marita"
  }
]

This flow is used to extract just the names of members in a group in a share point site. After a lot of trial and error, I finally got the above output in the compose function. But I cant proceed from there.


Solution

  • This is a flow that shows you what to do ...

    Flow

    Ignoring the fact that it's a manual trigger, the steps are ...

    Step 1. This compose action merely holds the array that you provided.

    Step 2. I initialize a string variable called Concatenated Names. It will store the resulting names concatenated by a space.

    Step 3. Insert an Apply to each action and set the output from the Compose step as the array to loop over.

    Step 4. The Append To Concatenated Names step is an Append to string variable action from the Data Operations group.

    In there, you want to have this expression (noting that there is a space in front of that string, it's hard to see but it's there) ...

     @{item()['Title']}
    

    Step 5. That's just a step to show you the results.

    You may want to trim the final result as well so the leading space is removed. To do that, use the trim() function.