Fetch XML node value (with condition on other node values) using Execute Xpath utility in UIPath

Slightly old thread, but thought I would just put some details in here to help those searching.

using below statement in Execute xpath utility helped me at last :slight_smile:

β€œstring(/Records-Set/record[A = '”+var1.ToString+β€œβ€™][B=’”+var2.ToString+β€œβ€™]/Leadtime)”

If the XML looks the same

<Records-Set>
  <record>
    <A>...</A>
    <B>...</B>
    <C/>
    <D/>
    <E>True</E>
    <Leadtime>12</Leadtime>
  </record>
  ...
</Records-Set>

You can shorten your XPATH expression a little by search for //record instead of the ROOT element /Records-Set/record....

So it looks like

"//record[A = '" + var1 + "'][B = '" + var2 + "']/Leadtime"

It’s not much in this particular example, but for deeply nested structures, starting from the root would get messy.

And as you figured out, wrapping your XPATH expression in the String() function returns the string value of the single node, for a parent element string() would return the string values of each of the child nodes.