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 / Creating an expression...
Power Automate
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!

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

    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

  • PJS-Data-Admin Profile Picture
    141 on at

    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!

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 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard