wiki:SeventhQuery
Last modified 11 years ago Last modified on 11/27/06 10:40:10

return to XbrainEvaluation

let $patients_morph :=
dxq:csm("
let $morph_codes := ('7')
return
<results>
{
for $p in $root/patient
return
    let $trials := $p/surgery/csmstudy/trial[trialcode/term[type='CSM error code']/abbrev/text()=$morph_codes]
    return
    if(exists($trials))
    then
        <patient>
        {$p/pnum}
        {
            for $trial in $trials
            return

                <trial>
                    {$trial/trial_num}
                    {$trial/item}
                    {$trial/patient_response}
                </trial>

         }
         </patient>
     else()
}
</results>
")

return 
<patients>
    {$patients_morph/results/patient}
</patients>