# AQL issue when selecting content **Category:** [Implementation](https://discourse.openehr.org/c/implem/39) **Created:** 2023-08-24 16:12 UTC **Views:** 391 **Replies:** 1 **URL:** https://discourse.openehr.org/t/aql-issue-when-selecting-content/4377 --- ## Post #1 by @ISys I am trying do query some detailed parameters using AQL. I am trying to select by content, like: ``` SELECT c FROM EHR e CONTAINS COMPOSITION c WHERE c/content/archetype_node_id = 'openEHR-EHR-SECTION.adhoc.v1'" ``` But then response from EHRBASE is ``` Could not process query/stored-query, reason: java.lang.StringIndexOutOfBoundsException: begin 0, end -1, length ``` In whole composition it is as below (excerpt): ``` }, "archetype_node_id": "openEHR-EHR-COMPOSITION.health_summary.v1", "content": [ { "name": { "value": "History of present illness section", "_type": "DV_TEXT" }, "archetype_node_id": "openEHR-EHR-SECTION.adhoc.v1", "_type": "SECTION", "items": [ { "name": { "value": "History of present illness", "_type": "DV_TEXT" }, ``` But when my query is: ``` SELECT c FROM EHR e CONTAINS COMPOSITION c WHERE c/archetype_node_id = 'openEHR-EHR-COMPOSITION.health_summary.v1' ``` Then it is ok. My suspicion relates to the square parenthesis on the content section, but I am not sure. How to filter content data? Thank you, --- ## Post #2 by @ian.mcnicoll This looks like it is a bug in ehrBase which I suggest you report, as it works as expected in the BetterCDR. However you can achieve the same goal with ``` SELECT c FROM EHR e CONTAINS COMPOSITION c CONTAINS SECTION s[openEHR-EHR-SECTION.adhoc.v1] ``` --- **Canonical:** https://discourse.openehr.org/t/aql-issue-when-selecting-content/4377 **Original content:** https://discourse.openehr.org/t/aql-issue-when-selecting-content/4377