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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to extract values ...
Power Automate
Unanswered

How to extract values from a specific field and separate them by commas

(0) ShareShare
ReportReport
Posted on by 143
Hi Everyone!!

I have a 'Filter Array' action in Power Automate where I am extracting values from a specific field in the resulting array.
Below is an example of the filtered data I get back:
 
{
    "body": [
        {
            "ItemInternalId": "abc12345",
            "Contractor Name": "John Doe",
            "Assigned Enterprise ID": "john.doe",
            "Assignment ID": "12345",
            "Status": "Active",
            "Assignment Work Country": "Country A",
            "Project Name": "Project A",
            "Client Name": "Client A"
        },
        {
            "ItemInternalId": "xyz98765",
            "Contractor Name": "Jane Smith",
            "Assigned Enterprise ID": "jane.smith",
            "Assignment ID": "67890",
            "Status": "Active",
            "Assignment Work Country": "Country B",
            "Project Name": "Project B",
            "Client Name": "Client B"
        }
    ]
}
 
From this, I want to extract only the 'Assignment ID' values and return them as a string separated by commas, like this:

12345, 67890.

How can I achieve this in Power Automate? I'm looking for a solution that directly extracts these values and formats them as a comma-separated string.

Thank you for your help!
Categories:
I have the same question (0)
  • RaulLessa Profile Picture
    2 on at

    Hello!
    Here is the solution to extract only the 'Assignment ID' values and return them as a string separated by commas:

    Step 1: Add your JSON to a Compose action.

     

    Step 2: Add a Select action and populate the fields as follows:

    • From: outputs('Compose').body
    • Map: item()?['Assignment ID']
     
    Step 3: Add a Join action. In the From field, add the output of the Select action: body('Select').
    And Join with field add ", "
     
    Final Result:
    Hope this helps!

    If I helped you solve your problem—please mark my post as a solution.
    Consider giving me a 👍 if you liked my response!
     
     
     
  • FlowFalcon Profile Picture
    143 on at

    Thank you, RaulLessa 

    I encountered an error in the select step due to the ".body" in step #2. The error was as follows:

    "The template language expression 'outputs('Compose').body' cannot be evaluated because property 'body' cannot be selected. Array elements can only be selected using an integer index."

    The solution was to remove ".body," so the expression ended up as: outputs('Compose').

  • Chriddle Profile Picture
    8,436 Super User 2025 Season 2 on at
    ...or just use an expression to replace the filter etc. (assuming you are only filtering for items whose contractor names are not empty):
    join(	
    	xpath(
    		xml(json(concat('{"Root":{"Item":', outputs('Compose'), '}}'))),
    		'//Item[Contractor_x0020_Name !=""]/Assignment_x0020_ID/text()'
    	),
    	', '
    )
     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard