Hi Greg, If I understand your requirement correctly the following is the correct AQL (take note of the RM class capitalisation):
Select pupils >From EHR e CONTAINS COMPOSITION anyComposition CONTAINS OBSERVATION pupils[openEHR-EHR-OBSERVATION.pupils.v1] Where pupils/data/events[at0002]/data/rows[at0013]/items[at0015]/value/defining_co de/code_string = 'at0016' A possible variation of the WHERE expression is as follows: Where pupils/data/events[at0002]/data/rows[at0013]/items[at0015]/value/defining_co de = 'local::at0016' Regards Heath > -----Original Message----- > From: openehr-technical-bounces at openehr.org [mailto:openehr-technical- > bounces at openehr.org] On Behalf Of Greg Caulton > Sent: Thursday, 2 October 2008 11:43 PM > To: For openEHR technical discussions > Subject: AQL querying by internal code > > Will the AQL queries qualifying on Archetype internal codes do so > using the value of the code and if so will it use the full path to > that value. > > For example if we wanted to find all patients with pupils observed to > be sluggish/slow would the query be: > > Select pupils > >From EHR e CONTAINS Composition anyComposition CONTAINS Observation > pupils[openEHR-EHR-OBSERVATION.pupils.v1] > Where > pupils/data/events[at0002]/data/rows[at0013]/items[at0015]/value = > pupils/data/events[at0002]/data/rows[at0013]/items[at0015]/value/defining_co de > /[at0016] > > where [at0016] is the internal code for that archetype. > > I couldn't find an example on the wiki. > > thanks! > > Greg > _______________________________________________ > openEHR-technical mailing list > openEHR-technical at openehr.org > http://lists.chime.ucl.ac.uk/mailman/listinfo/openehr-technical

