Does anyone know how to query a value that’s inside an Array List?
In my case, I would like to get the value of id, type, issuer, and assigner. Here is the sniped composer data:
SELECT c0, c0/composer/identifiers
FROM COMPOSITION c0[openEHR-EHR-COMPOSITION.encounter.v1]
...
WHERE ...
With that query, I can only capture the value as an object, which is an array list.
It will be easier if that composer has something like archetype_node_id, but sadly, it does not have it.
The reason why I need this is that I want to use one of that values as one of the Where conditions once I know how to capture the value(s).
I think it depends on the implementation. Some implementations have the IN/matches operator which allows you to filter a list in the WHERE, though I don’t know if it’s possible to filter a list of structured data instead of a list of atomic data like List.
Can you provide a data set and the expected result for the data retrieval from that data set?
Hi @ardihikaru, it really depends on the actual implementation of AQL engien. However, it is worth of trying the following AQL statements.
If the criteria is on the identifiers:
SELECT c0, c0/composer/identifiers
FROM COMPOSITION c0[openEHR-EHR-COMPOSITION.encounter.v1]
…
WHERE EXISTS c0/composer/identifiers[id=‘xxx’]
If you just want to retrieve the particular identifier with a particular type, you can do the following:
SELECT c0, c0/composer/identifiers[type=‘xxx’]/id, c0/composer/identifiers[type=‘xxx’]/issuer
FROM COMPOSITION c0[openEHR-EHR-COMPOSITION.encounter.v1]
…
Hope it helps.
Regards,
Chunlan