dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #44763
Support of "IN" clauses in SQL Views / Queries?
Hi,
We're attempting to pull data from DHIS 2 via DHIS 2 SQL Views / Queries
and want to be able to use "IN" clauses to filter the data. Is there a way
to do this?
For example we want to create a SQL View or query to get tracked entity
data values, but only for specific data elements. The number of data
elements that will be used in a filter will vary.
The documentation here doesn't mention anything:
http://dhis2.github.io/dhis2-docs/master/en/developer/html/ch01s30.html
Attempting to create a query with a variable like this doesn't seem to work
(it seems to not allow quoting and commas):
select * from foo where bar in (${bars});
Alternately, is it possible to add criteria to a sql view where the
criteria are appended as "OR"s?
view: select * from foo;
/api/sqlViews/UuRVaRmfHwa/data.csv?criteria=bar:azikLil2Nl1&criteria=bar:A2Kgu7zMgJr
(select * from foo where bar= azikLil2Nl1 OR bar = A2Kgu7zMgJr;)
This one seems more complicated because we would want a mixture of "AND"s
and "OR"s for our particular view.
Please let us know thoughts on how we can get this to work for our use case.
Thanks!
Lorill
Follow ups