Using Azure Logic App to select XML node values

manu 41 Reputation points
2021-06-24T03:20:39.533+00:00

Hi,
I have a requitement to node values in to array in logic apps.I tried Xpath with multiple ways ,but always getting null value.Could you please help how to get the values from XML.

Path: Upsscs/EcommerceNotification/OrderReferenceFields/ReferenceField.
Expected Values in Array is =[79787709,936N5D4CPU]

108861-image.png

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,324 questions
Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,873 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Mike Urnun 9,761 Reputation points Microsoft Employee
    2021-06-27T21:19:47.51+00:00

    Hello @manu

    You can use the text() function in your xpath to query the nodes with text values, as follows: Upsscs/EcommerceNotification/OrderReferenceFields/ReferenceField[text()]

    In order to run this query in Logic Apps and work with the returned values as an array, you can use the xpath() function: https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#xpath

    From your example, that xpath should return the following nodes:

            <ReferenceField id="1">79787709</ReferenceField>  
            <ReferenceField id="2">936N5D4CPU</ReferenceField>   
    

    I hope this helps, let me know if you have any further questions.