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!