Olav’s approach might work, but would not allow you to conduct a min-max analysis (although you could do it through the validation rules analysis in this way). The advantage with the min/max is that it may be a bit more intuitive, especially with the data entry page and the graph which displays historical values.
Anyway, you could adapt this SQL query for your own use, which we have used in the past for a very similar situation.
DELETE FROM minmaxdataelement where dataelementid = 94442 and categoryoptioncomboid = 13 and sourceid IN (SELECT DISTINCT idlevel4 from _orgunitstructure where idlevel4 IS NOT NULL);
INSERT INTO minmaxdataelement
SELECT nextval(‘hibernate_sequence’::regclass) as minmaxdataelementid, a.organisationunitid as sourceid,
94442 as dataelementid, 13 as categoryoptioncomboid,
0 as minimumvalue, 10 as maximumvalue, TRUE as generated
FROM organisationunit a
where a.organisationunitid in ( SELECT DISTINCT idlevel4 from _orgunitstructure where idlevel4 IS NOT NULL);
The first query will get rid of all min/max values of the specified dataelement/categoryoptioncombo/source combination.
The second query will insert the values.
You should adjust the dataelementid/categoryoptioncomboids to suit your needs. The highlighted part of the query is going to return organisationunit IDs, and in this case, I took all level 4 orgunits. Of course, this might need to be adjusted to suit your needs (different orgunit level, restricting by membership in a dataset or orgunit group, or something similar).
Hope this helps.
Regards,
Jason
···
On Thu, Sep 19, 2013 at 10:26 AM, Olav Poppe olav.poppe@me.com wrote:
Hi,
I think you could make a Validation rule for this, where you specify that the data element should be less than your maximum value.
left side: [data element]
operator: <
right side [max value]
Olav
- sep. 2013 kl. 10:22 skrev conrad muyepa cmuyepa@gmail.com:
Hi,
What i have observed, Min-max value is for a particular data element and for a particular org-unit.so each facility should have its own min-max values for each data element…In our case we want to set min max values for a particular data element to be applied to all facilities and periods even future periods. I don’t have to open the data entry form and double click in each field to set it …Is it possible to do this once not manually?? I have tried to use min max generation its not working…
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp