← Back to team overview

dhis2-devs team mailing list archive

Re: Global ranges

 

On Wed, May 20, 2009 at 3:57 AM, Ngoc Thanh Nguyen <
thanh.hispvietnam@xxxxxxxxx> wrote:

>
>
> - if you want all dataelements have ranges
>
> insert into minmaxdataelement(sourceid, dataelementid, minvalue, maxvalue)
> select organisationunitid, dataelementid, 0, 99 from organisationunit,
> dataelement
>

This will not run without modifications: ERROR: null value in column
"minmaxdataelementid" violates not-null constraint

You could probably make the id column serial to cope with that.  Also, not
sure if you should have the default value for categoryoptioncomboid or leave
it as NULL.


> - if you only want those dataelements belonging to datasets assigned to
> certain orgunit
>
> insert into minmaxdataelement(sourceid, dataelementid, minvalue, maxvalue)
>
> select o.organisationunitid, dm.dataelementid, 0, 99
> from organisationunit o inner join datasetsource ds on o.organisationunitid
> = ds.sourceid
> inner join datasetmembers dm on dm.datasetid = ds.datasetid
>

This is better (with same comment as above).

Knut

Follow ups

References