Hi all,
please could you help me write this xquery correctly? I don’t understand what’s wrong in it:
for $a in distinct-values(input()/List//@key)
let $b := count(for $aa in input()/List where $aa/@key= $a return $aa)
let $c := count(for $aa in input()/List where $aa/@key= $a and $aa/@available=“True” return $aa)
update for $z in collection(Index)/Index
let $x := $z/@total
let $y := $z/@partial
where $z/@id=$a
do ( replace $x with attribute total {$b}
replace $y with attribute partial{$c})
update
for $a in distinct-values(input()/List//@key)
let $b := count(for $aa in input()/List where $aa/@key= $a return $aa)
let $c := count(for $aa in input()/List where $aa/@key= $a and $aa/@available="True" return $aa)
for $z in collection("Index")/Index
let $x := $z/@total
let $y := $z/@partial where $z/@id=$a
do ( replace $x with attribute total {$b} replace $y with attribute partial{$c})
I did not check whether the query does what you expect