xquery update with join

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})

Thanks in advance,

Pam

Hi,

the correct syntax is


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

Regards

Harald

No! Interactive Interface response is:

<ino:message ino:returnvalue=“6360”>
<ino:messagetext ino:code=“INOXQE6360”>Unbound path not allowed here</ino:messagetext>
ino:messagelineLine 5, column 22: </ino:messageline>
</ino:message>

Why?

Excuse me! It runs correctly!
Thank you very much!