Hello Radim
Your WHERE clause is either true or false depending whether “Failed” is in $FailedTests sequence or not. With ‘=‘ you compare sequences and not values. If one item matches it is true.
let $FailedTests:=… return count($FailedTests[. eq ‘Failed’])
Cheers Leo
On 18 Aug 2017, at 10:49, radim-havlicek@post.cz wrote:
Hello, I want to count failed reports in DB, it means where outcome value of report is "Failed".
declare namespace TestResults='urn:IEEE-1671:2009.04:TestResults'; declare namespace Common='urn:IEEE-1671:2010:Common';
let $DocumentNames := (db:list("ASC", "Report")) for $DocumentName in $DocumentNames let $Document := db:open('ASC',$DocumentName)
let $FailedTests := $Document/TestResults:TestResults/TestResults:ResultSet/TestResults:TestGroup/TestResults:TestGroup/TestResults:TestGroup/TestResults:TestGroup/TestResults:Test/TestResults:Outcome/data(@value) where $FailedTests="Failed" return count($FailedTests)
However, it counts all reports, no matter if the value is "Passed" or "Failed". If I change the end to: return $FailedTests, it displays both "Failed" and "Passed" values. If I change it to: where $FailedTests="Test", it displays correctly 0 reports. What am I doing wrong?
Thank you in advance for your reply.
Radim Havlicek