Search code examples
xmlxpathnintex-workflow

Nintex for O365: XPath query is invalid. Expression must evaluate to a node-set


I'm having an Infopath form which is having sections numbered from 0 to 14. They are being filled based on some rules. I'd like to use a "Query XML" action to get only those having values in nodes (where {n} is the next number from 0 to 14). I'm then using the following XPath query:

//my:Approvals/*[starts-with(name(), 'my:Approve')][*[starts-with(name(), 'my:ID') and text() >= 0]]

When I'm testing the query using the http://www.xpathtester.com/xpath tester it returns me 3 nodes. However when I execute my workflow processing the actions logs error message:

XPath query is invalid. Expression must evaluate to a node-set..

I have no idea how to debug what this action is returning or what am I doing wrong, when on the other hand XPath tester tells me everything should be correct...

I highly appreciate any help

Best regards, Tomasz


Solution

  • It seems that everything was correct. Well, the better query is:

    //my:Approvals/*[starts-with(name(), 'my:Approve')][*[starts-with(name(), 'my:ID') and text()[number()>=‍0]]]
    

    So the one, that coverts node value into a number, but in the end the problem was, that the tested value was being passed as a variable and.. it turned out it was empty at the time of comparison.

    So my bad, thanks for your time trying figuring out what is wrong ;)

    Regards, Tomasz