← Back to team overview

dhis2-users team mailing list archive

Output Raw Data in a matrix format -- DHIS2 2.24

 

Dear Community,


With DHIS2 2.24, I am trying to output raw data in a matrix format. I have
used SQL View to output the data. Data values table is presented as
following:


*orgUnit UID,  dataElement1, Value, Period*

*orgUnit UID,  dataElement2, Value, Period*

*orgUnit UID,  dataElement3, Value, Period*

*orgUnit UID,  dataElement4, Value, Period*

*...*


I have used the following code:


select dv.sourceid as organisationunitid, ou.name, ou.shortname, ou.code as
CodeAC, de.name as intitule, pe.startdate, pe.enddate,
coc.categoryoptioncomboname, dv.value from datavalue dv inner join
organisationunit ou on (dv.sourceid=ou.organisationunitid) inner join
dataelement de on (dv.dataelementid=de.dataelementid) inner join period pe
on (pe.startdate='2016-02-01') inner join _categoryoptioncomboname coc on
(dv.categoryoptioncomboid=coc.categoryoptioncomboid) where dv.dataelementid
in (select dataelementid from datasetmembers where datasetid in (select
datasetid from dataset where name='dataSetName'));



I would like to output “raw data” for each orgUnit as following:



*orgUnit UID,  dataElement1, Value, dataElement2, Value, dataElement3,
Value, dataElement4,  Value, Period*

*...*



I have used pivot tables , but it is each time doing data agregation of the
dataElement.



How should I arrange the SQL code in order to have this result?



Kind Regards,

Tantely.

-- 
*This message and its attachments are confidential and solely for the 
intended recipients. If received in error, please delete them and notify 
the sender via reply e-mail immediately.*

Follow ups