← Back to team overview

dhis2-users team mailing list archive

Re: [Dhis2-devs] Auto-calculated data in entry forms

 

Ook. Thanx :)


On Tue, Sep 2, 2014 at 2:02 PM, Ngoc Thanh Nguyen <
thanh.hispvietnam@xxxxxxxxx> wrote:

> Hi
>
> it is already inside dhis2 (for every dhis2 page). no need for external
> import
>
> Thanh
>
>
>
> On Tue, Sep 2, 2014 at 2:17 PM, Pamod Amarakoon <pamodm@xxxxxxxxx> wrote:
>
>> Hi,
>>
>> Thanx. Is jquery available inside data entry form on the fly or has to
>> link it separately to outside library.
>>
>>
>>
>>
>> On Tue, Sep 2, 2014 at 12:31 PM, Ngoc Thanh Nguyen <
>> thanh.hispvietnam@xxxxxxxxx> wrote:
>>
>>> great. surprised that a medical doctor can write that code. if you turn
>>> it to jquery it is much easier. anyway, its fine for now
>>> On Sep 2, 2014 11:54 AM, "Pamod Amarakoon" <pamodm@xxxxxxxxx> wrote:
>>>
>>>> Hi,
>>>>
>>>> Thanks a lot. In fact I'm a medical doctor and have limited knowledhe
>>>> in Javascript. I managed to get it done with following javascript I created.
>>>>
>>>> height enterd in cm and weight in kg.
>>>>
>>>> <script type="text/javascript">
>>>>
>>>> function updateBMI() {
>>>> var ht = document.getElementById("HeightID-val").value;
>>>> var wt = document.getElementById("WeightID-val").value;
>>>> if(ht!="" && wt!=""){
>>>> var bmi = wt/(ht*ht/10000);
>>>> bmi = +bmi.toFixed(2);
>>>> }else{
>>>> var bmi ="Enter Height and Weight";
>>>> }
>>>> var inputbmi= document.getElementById("BMI-ID-val");
>>>> inputbmi.value = bmi;
>>>> }
>>>> updateBMI();
>>>>
>>>> </script>
>>>>
>>>> It serves the purpose it seems. Pls suggest any modifications
>>>>
>>>>
>>>> On Mon, Sep 1, 2014 at 11:52 PM, Ngoc Thanh Nguyen <
>>>> thanh.hispvietnam@xxxxxxxxx> wrote:
>>>>
>>>>> yes you can use custom data entry form and add some js script like
>>>>> onchange event on weight and height.
>>>>>
>>>>> the event handler should then calculate the bmi and update the text
>>>>> field bmi.
>>>>>
>>>>> do you have any technical person to do this? if not give me your
>>>>> account i can help
>>>>> On Sep 2, 2014 12:26 AM, "Pamod Amarakoon" <pamodm@xxxxxxxxx> wrote:
>>>>>
>>>>>> I'd like to add something to this.
>>>>>>
>>>>>> For example, if we have a data entry form (BMI) for a program stage
>>>>>> if we have height and weight input boxes/data elements is there a way to
>>>>>> calculate BMI?
>>>>>> is it only possible by using javascript/webapp
>>>>>>
>>>>>>
>>>>>> On Mon, Sep 1, 2014 at 10:21 PM, Ngoc Thanh Nguyen <
>>>>>> thanh.hispvietnam@xxxxxxxxx> wrote:
>>>>>>
>>>>>>> Hi
>>>>>>>
>>>>>>> I believe the calculated data value (now as indicator) can only be
>>>>>>> seen after an aggregation is run.
>>>>>>> In addition, in some forms in some countries like VN,
>>>>>>> auto-calculated data elements some time can be input by users.
>>>>>>>
>>>>>>> In VN, we use Javascript to achieve this. However, it is quite
>>>>>>> complicated. Imagine that you have to rebuild a spreadsheet engine.
>>>>>>>
>>>>>>> Important lesson learnt was if a dataelement is auto-calculated,
>>>>>>> make sure no one can change it manually. Otherwise, you end up with very
>>>>>>> low data quality.
>>>>>>>
>>>>>>> Thanh
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Sep 1, 2014 at 11:15 PM, Jason Pickering <
>>>>>>> jason.p.pickering@xxxxxxxxx> wrote:
>>>>>>>
>>>>>>>> Hi Robin,
>>>>>>>>
>>>>>>>> You can simply use an indicator to do this.
>>>>>>>>
>>>>>>>> In case you have not seen it, we have extensive documentation on
>>>>>>>> the use of indicators here
>>>>>>>>
>>>>>>>>
>>>>>>>> https://www.dhis2.org/doc/snapshot/en/user/html/ch13.html#indicator_maintenance
>>>>>>>>
>>>>>>>> It should also be possible to calculate the value from other data,
>>>>>>>> not contained in the data entry form, IF it exists for the same orgunit and
>>>>>>>> period.
>>>>>>>>
>>>>>>>> Best regards,
>>>>>>>> Jason
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Mon, Sep 1, 2014 at 5:48 PM, Robin Martens <martens@xxxxxxx>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>>   Dear all,
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Does anyone know if there's a way to have auto-calculated fields
>>>>>>>>> in data entry forms? This auto-calculated field would then be available for
>>>>>>>>> further reporting and indicator calculation (i.e. it is a data element
>>>>>>>>> calculated based on other data elements in the same entry form).
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Actually, if it would be possible to calculate data elements based
>>>>>>>>> on other data elements outside of a data form, that would be great too (but
>>>>>>>>> if I remember well this is currently not possible).
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Thanks for any ideas,
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Robin
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> Mailing list: https://launchpad.net/~dhis2-devs
>>>>>>>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>>>>>>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>>>>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Mailing list: https://launchpad.net/~dhis2-devs
>>>>>>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>>>>>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>>>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Mailing list: https://launchpad.net/~dhis2-devs
>>>>>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>>>>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Pamod
>>>>>>
>>>>>>
>>>>
>>>>
>>>> --
>>>> Pamod
>>>>
>>>>
>>
>>
>> --
>> Pamod
>>
>>
>


-- 
Pamod

Follow ups

References