TomaszPoszytek
Automation Master
Automation Master

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

Jump to solution

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 <ID{n}> (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

Reply
1 Reply
TomaszPoszytek
Automation Master
Automation Master

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

Jump to 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

View solution in original post

0 Kudos
Reply