[Dhis2-devs] Getting the OU for items recorded in datavalues table

2018-06-19 Thread Edward Robinson
How can the OU be determined for the data in the datavalues table? The fields are dataelementid, periodid, sourceid, categoryoptioncomboid, attributeoptioncomboid, value, storedby, created, lastupdated, comment, followup, deleted I'm guessing it involves the sourceid field (and possibly others) b

Re: [Dhis2-devs] Getting the OU for items recorded in datavalues table

2018-06-19 Thread David Huser
Hi Ed, This should get you started: SELECT dv.dataelementid, dv.value, ou.name FROM datavalue dv JOIN organisationunit ou ON ou.organisationunitid = dv.sourceid; Best, David On Tue, Jun 19, 2018 at 2:21 PM Edward Robinson < erobin...@projectbalance.com> wrote: > How can the OU be determined fo

Re: [Dhis2-devs] Getting the OU for items recorded in datavalues table

2018-06-19 Thread Edward Robinson
Oh wow, that simple? Sourceid = organisationunitid? Thanks for the quick response David. For some reason I was expecting organisationunitid to be present in the datavalue table. Do you know the reason it’s called sourceid? Ed From: David Huser Sent: Tuesday, 19 June 2018 2:33 PM To: Edward R

Re: [Dhis2-devs] Getting the OU for items recorded in datavalues table

2018-06-19 Thread Brajesh Murari
sourceid is available for distinguishing different types of organizationunit. It is one of id available since DHIS 1. In some of the DHIS2 releases, it was removed and later on it was found very useful, so it was included. It's like parent to organisationunit. BM On Tue 19 Jun, 2018, 6:06 PM Edwa