none
extracting value with xpath RRS feed

  • Question

  • Hi forum, 

    I have to extract a value from xml filed <employmentCode>T</employmentCode> and assign it to a logic apps variable. I use the correct xpath expression, but what I am seeing in the variable is not T, but ["T"]

    My xpath is like this: 

    xpath(item(), '/*[local-name()=...../text()')

    So further down the road where I have to check if the status is equal "T" I have to write condition like this and include the brackets: 

    "expression": {
    "or": [
    {
    "equals": [
    "@variables('employmentCode')",
    "[\"T\"]"
    ]
    },

    So my questions is how to I get rid of those brackets and where are they coming from?

    Thanks!

     





    • Edited by fly2 Thursday, February 28, 2019 6:39 PM
    Thursday, February 28, 2019 6:30 PM

Answers

  • Solved: And I was warned yesterday om this forum that xpath return an arrays, I just didn;t pay attention

    It must be:

    first(xpath(item(), '/*[local-name()=...../text()'))

    • Marked as answer by fly2 Thursday, February 28, 2019 6:45 PM
    Thursday, February 28, 2019 6:45 PM