Hi,
I am enrolling a child with certain attributes like First Name, Last Name, Phone Number and saving it on the server using the Android SDK.
How can I retrieve that enrollment based on the Phone Number value?
Thanks,
Apoorv
Hi,
I am enrolling a child with certain attributes like First Name, Last Name, Phone Number and saving it on the server using the Android SDK.
How can I retrieve that enrollment based on the Phone Number value?
Thanks,
Apoorv
Hi Apoorv,
Here is an example of web API calls and SDK method references which will search TrackedEntityInstances based on attribute values.
Demo server credentials:
username: android
password: Android123
First, you need to find TrackedEntityInstance (child) on server by filtering on corresponding attributes (phone number or first name in this example).
Example of API request: https://play.dhis2.org/demo/api/trackedEntityInstances.json?ou=DiszpKrYNg8&program=IpHINAT79UW&filter=w75KJ2mc4zz:LIKE:donald
In SDK, you can use TrackerController.queryTrackedEntityInstancesDataFromServer() method which allows you to search TrackedEntityInstances based on attribute values.
Second, you need to get enrollments which are assigned to given TrackedEntityInstance.
Example of API request: https://play.dhis2.org/demo/api/enrollments.json?ou=DiszpKrYNg8&program=IpHINAT79UW&trackedEntityInstance=XF7tJoenIpr
This call will download and save specified TrackedEntityInstances with assigned Enrollments:
Best regards,
—
Araz Abishov,
Android developer, DHIS 2
University of Oslo
On May 15, 2016 at 3:02:49 AM, Apoorv Patel (patelapoorv9990@gmail.com) wrote:
Hi,
I am enrolling a child with certain attributes like First Name, Last Name, Phone Number and saving it on the server using the Android SDK.
How can I retrieve that enrollment based on the Phone Number value?
Thanks,
Apoorv
Mailing list: DHIS 2 developers in Launchpad
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : DHIS 2 developers in Launchpad
More help : ListHelp - Launchpad Help