I've been trying to use the following guidance to merge to arrays with a common identifier, however I keep having errors: [How to merge arrays in Power Automate (tachytelic.net)](https://www.tachytelic.net/2022/07/power-automate-merge-array/#:~:text=How%20to%20merge%20two%20arrays%20in%20Power%20Automate,expression%20to%20perform%20this%20in%20a%20single%20step.)
I am using the following formula: addProperty
(
item(),
'Request_x0020_Status',
xpath(outputs('XML'), concat('//Array[Reference/text()="', item()?['Reference'], '"]/Request_x0020_Status/text()'))?[0]
)
and I get the following error: The execution of template action 'Select' failed: The evaluation of 'query' action 'where' expression '{
"ID": "@item()?['ID']",
"Reference": "@item()?['Reference']",
"Status": "@xpath\r\n(\r\n outputs('XML'), \r\n concat('//Array[Reference/text()=\"', item()['Reference'], '\"]/Request_x0020_Status/text()')\r\n)?[0]"
}' failed: 'The template language function 'xpath' parameters are invalid: the 'xpath' parameter must be a supported, well formed XPath expression. Please see https://aka.ms/logicexpressions#xpath for usage details.'.
Any ideas of what could be wrong?
For reference, here is the example XML I am trying to search through:
<root>
<Array>
<ASID>98111</ASID>
<Reference>ICT-27</Reference>
<Request_x0020_Status>Accepted</Request_x0020_Status>
<Due_x0020_Date>2022-09-26T00:00:00.000Z</Due_x0020_Date>
<Title>Title of Property</Title>
<Instructions>Tested</Instructions>
<Population_x0020_Request>No</Population_x0020_Request>
</Array>
and my array I am adding to example is:
[
{
"ID": 1139,
"Reference": [
"ICT-27",
" ICT-29",
" ICT-33"
]
}
I am looking to add the Request_x0020_Status text to the array for each from the first array.
Appreciate the help!