I am trying to build and AQL using MATCHES in WHERE. The need to is to be able to pass an array of values to the WHERE condition. I am doing the following
{
"q": "SELECT c1/uid/value as uid, c4/items[at0009]/items[at0010]/value/value as encounterId, c4/items[at0014]/items[at0016]/value/value as hiType FROM EHR e CONTAINS COMPOSITION c1 CONTAINS CLUSTER c4[openEHR-EHR-CLUSTER.ehrn_metadata.v1] WHERE c4/items[at0009]/items[at0010]/value/value MATCHES {$EncounterIdArray} and c4/items[at0014]/items[at0016]/value/value MATCHES {$hiTypeArray}",
"offset": 0,
"fetch": 10,
"query_parameters": {
"EncounterIdArray": "Encounter/ee2c037d-c499-4aa0-9097-03f6c7e7aa74",
"hiTypeArray": "Prescription, DischargeSummary"
}
}
However the quesry executed by EHRBase is as below
"_executed_aql": "SELECT c1/uid/value AS uid, c4/items[at0009]/items[at0010]/value/value AS encounterId, c4/items[at0014]/items[at0016]/value/value AS hiType FROM EHR e CONTAINS COMPOSITION c1 CONTAINS CLUSTER c4[openEHR-EHR-CLUSTER.ehrn_metadata.v1] WHERE (c4/items[at0009]/items[at0010]/value/value MATCHES {'Encounter/ee2c037d-c499-4aa0-9097-03f6c7e7aa74'} AND c4/items[at0014]/items[at0016]/value/value MATCHES {'Prescription, DischargeSummary'}) LIMIT 10 OFFSET 0
The array of values passed in the query is being interpreted as one string by the server.
What is the correct syntax to pass an array of values in the query_parameters so that the server interprets them correctly?
regards