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 join non-primit...
Power Automate
Answered

How to join non-primitive array values using expression

(0) ShareShare
ReportReport
Posted on by 15

Hi,

An "Employees" field from Sharepoint list returns an array of JSON datatype, as follows:

 

[{
 "DisplayName": "John Doe",
 "Department": null,
 "JobTitle": null
}, {
 "DisplayName": "Mary Jane",
 "Department": null,
 "JobTitle": null
}]

 

In the next step, this field value inserted in Excel.

What I need is to join in one string only DisplayName values separated by a semicolon, like: "John Doe, Mary Jane"

I am able to get DisplayName value using index numbers:

 

triggerBody()?['Employees'][0]?['DisplayName']
// returns: John Doe

 

I can also concatenate several array indexes, but I don't know in advance how many elements will be in an array.

How can I join values from an array using expressions (formulas) only? Maybe some additions to join function will help? I tried the next one, but it didn't work

 

join(triggerBody()?['Employees']?['DisplayName'], ';')

 

 

Categories:
I have the same question (0)
  • Verified answer
    v-bacao-msft Profile Picture
    on at

     

    Hi @elshadlive ,

     

    Please try the following configuration:

    59.PNG60.PNG

     

    Best Regards,

  • elshadlive Profile Picture
    15 on at

    @v-bacao-msft thank you for your reply.

    Can I do the same without using Activities, but using WDL inline expressions instead? I am not familiar with WDL and not sure if there is some iteration operator.

    I have about 30 columns from Sharepoint list, which must be read and then mapped (written) to Excel sheet. The field in a subject is only one of multiple array fields. Creating multiple Activities for each of those fields will be a nightmare.

    So, I am looking for a solution of converting multi-valued arrays to strings on mapping level for each field.

    fieldsList.png

    Assuming that I have to make different conversions and calculations on most of these fields I'd be grateful if you could suggest "coding way" of manipulating data instead of using Activities (of course within possibilities of the platform).

    On top of my mind I am thinking about something like:

    join(createArray(triggerBody()?['Employees'](ApplyForEachOperator)['DisplayName']), ';')
    or
    triggerBody()?['Employees'](SelectFunction)['DisplayName']
    
    // triggerBody()?['Employees'] is my array field

    where ApplyForEachOperator and SelectFunction keywords are iteration or selection operators

    Any suggestions?

  • v-bacao-msft Profile Picture
    on at

     

    Hi @elshadlive ,

     

    Unfortunately, as far as I know, the WDL function does not contain a function can be used to iterate items in an array.

    So we only can use Apply to each to iterate items in Power Automate.

     

    Best Regards,

  • elshadlive Profile Picture
    15 on at

    @v-bacao-msft thanks for the reply. I'll dig deeper and look for a maximum minimalistic solution. I'll post here if any success.

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