Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

Creating an expression from an array

(0) ShareShare
ReportReport
Posted on by 141

Hello all,

 

I do not think this is possible after some research and testing, but I wanted to see if anyone else has any tricks to do this. I have an array that looks like this:

 

[
 {
 "ManagerName": "ManagerName1",
 "ManagerEmail": "ManagerEmail1"
 },
 {
 "ManagerName": "ManagerName2",
 "ManagerEmail": "ManagerEmail2"
 },
 {
 "ManagerName": "ManagerName3",
 "ManagerEmail": "ManagerEmail3"
 }
]

 

 

I want the output to be this:

 

concat(
 if(equals(item()?['assignees']?[0]?['name'], 'ManagerEmail1'), 'ManagerName1', ''),
 if(equals(item()?['assignees']?[0]?['name'], 'ManagerName1'), 'ManagerName1', ''),
 if(equals(item()?['assignees']?[0]?['name'], 'ManagerEmail2'), 'ManagerName2', ''),
 if(equals(item()?['assignees']?[0]?['name'], 'ManagerName2'), 'ManagerName2', ''),
 if(equals(item()?['assignees']?[0]?['name'], 'ManagerEmail3'), 'ManagerName3', ''),
 if(equals(item()?['assignees']?[0]?['name'], 'ManagerName3'), 'ManagerName3', '')
)

 


 I have tried using an apply to each loop to append an array, but when you output in a "Compose" action it is a string rather than a usable expression. Anyone have any ideas or is this truly not possible? I was just trying to simplify some of the expressions that require a manager name so that I can add or remove that data just from an array rather than in the expressions themselves.

 

In the last test, this was the output of my compose action:

 

concat(
if(equals(item()?['assignees']?[0]?['name'], 'ManagerEmail1'), 'ManagerName1', ''),
if(equals(item()?['assignees']?[0]?['name'], 'ManagerName1'), 'ManagerName1', '')if(equals(item()?['assignees']?[0]?['name'], 'ManagerEmail2'), 'ManagerName2', ''),
if(equals(item()?['assignees']?[0]?['name'], 'ManagerName2'), 'ManagerName2', '')if(equals(item()?['assignees']?[0]?['name'], 'ManagerEmail3'), 'ManagerName3', ''),
if(equals(item()?['assignees']?[0]?['name'], 'ManagerName3'), 'ManagerName3', '')
)

 

 

I appreciate any help!

  • PJS-Data-Admin Profile Picture
    141 on at
    Re: Creating an expression from an array

    Hello @v-yueyun-msft,

     

    That is correct, I wanted to create an expression dynamically based on an array of information. This would just help reduce the amount of maintenance needed in some expressions that use manager names, I would be able to just edit the array rather than the 4 formulas.

    Thank you anyway!

  • v-yueyun-msft Profile Picture
    on at
    Re: Creating an expression from an array

    Hi , @PJS-Data-Admin 

    According to your description,  you want to automatically generate a Power Automate expression and use it?
    In my experience, you may not be able to achieve it due to  expression can only be used in Expressions console in Power Automate.

     

    Best Regards,

    Yueyun Zhang

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1