dhis2-users team mailing list archive
-
dhis2-users team
-
Mailing list archive
-
Message #14545
Re: [Dhis2-devs] Populating data from Excel to DHIS2 Data Entry Web Form with Internet Explorer
Given the widespread knowledge of VBA coupled with the huge trove of legacy
data in Excel and the continued use of Excel for offline data collection,
it could be nice to add an appendix to the documentation with code snippets
to import data directly from Excel to the API, in addition to the R
documentation (munging?).
Perhaps it is something you could be interesting in developing and sharing,
Damasceno?
Cheers,
Knut
On Thu, Oct 26, 2017 at 4:55 PM, Jason Pickering <
jason.p.pickering@xxxxxxxxx> wrote:
> You may also want to consider just making the HTTP request, instead of
> working with the form itself
>
> https://support.microsoft.com/en-us/help/301102/how-to-make-
> a-get-request-by-using-visual-basic--net-or-visual-basic-2
>
> The DHIS2 dataValue API is documented in here
> <https://docs.dhis2.org/master/en/developer/html/webapi_data_values.html>
> in "Section 1.19.7. Sending, reading and deleting individual data values"
>
> Regards,
> Jason
>
>
> On Thu, Oct 26, 2017 at 4:18 PM, Damasceno Lopes <
> damascenolopess@xxxxxxxxx> wrote:
>
>> Hi!
>>
>>
>>
>> I’m trying to populate data from Excel to DHIS2 Data Entry Web Form
>> using VBA code in Excel with Internet Explorer, the data goes to form but
>> not persisted to database. Anyone already try to do that?
>>
>>
>>
>> The VBA code, tested to fill form in the demo instance:
>>
>>
>>
>> 'Before run this Macro make sure to login into dhis2-demo using Internet
>> Explorer
>>
>> Sub FillInternetForm()
>>
>> Dim IE As Object
>>
>>
>>
>> Set IE = CreateObject("InternetExplorer.Application")
>>
>>
>>
>> IE.Navigate "https://play.dhis2.org/demo/dhis-web-dataentry/index.action"
>>
>> IE.Visible = True
>>
>>
>>
>> While IE.busy
>>
>> DoEvents 'wait until IE is done loading page.
>>
>> Wend
>>
>>
>>
>> 'You have 30 seconds to choose Orgunit, form and period
>>
>> 'Eg. Sierra Leone, Emergency Response, Result
>>
>> Application.Wait Now + TimeValue("00:00:30")
>>
>>
>>
>> 'Populating Data to two first fields
>>
>> IE.document.getElementById("KFnFpbqDqji-bRowv6yZOF2-val").Focus
>>
>> IE.document.getElementById("KFnFpbqDqji-bRowv6yZOF2-val").Value = "20"
>>
>> Application.Wait Now + TimeValue("00:00:02")
>>
>> IE.document.getElementById("zFFb3bar4Ct-bRowv6yZOF2-val").Focus
>>
>> IE.document.getElementById("zFFb3bar4Ct-bRowv6yZOF2-val").Value = "30"
>>
>>
>>
>> End Sub
>>
>>
>>
>> The result:
>>
>>
>>
>>
>>
>> The Data goes to the field but not persisted, the field don’t change
>> color.
>>
>> I appreciate your help if you can provide.
>>
>>
>>
>> Thank you
>>
>> *Damasceno Lopes, MSc*
>>
>> *Health Information System Officer*
>>
>> Friends in Global Health, Mozambique
>>
>> *+258844626770 <+258%2084%20462%206770>* | *+258829502145
>> <damasceno.lopes@xxxxxxxxxx>*
>>
>> [image: FGH]
>>
>>
>>
>>
>>
>> _______________________________________________
>> 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
>>
>>
>
>
> --
> Jason P. Pickering
> email: jason.p.pickering@xxxxxxxxx
> tel:+46764147049 <+46%2076%20414%2070%2049>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-users
> Post to : dhis2-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help : https://help.launchpad.net/ListHelp
>
>
--
Knut Staring
Dept. of Informatics, University of Oslo
Norway: +4791880522
Skype: knutstar
http://dhis2.org
Follow ups
References