← Back to team overview

dhis2-devs team mailing list archive

Re: [Dhis2-users] Regarding Data sort through an APi

 

Yes exactly, I  want to do collection sorting directly through the Api.

Thanks for your time!

On Mon, Feb 29, 2016 at 3:45 PM, Morten Olav Hansen <morten@xxxxxxxxx>
wrote:

> Yes, the query you are giving there is different from what you gave
> before. You can't do collection sorting, which I assume is what you want?
>
>
> https://play.dhis2.org/demo/api/dataElementGroups.json?fields=id,displayName&order=displayName:desc
>
> These kinds of sorts works.
>
> On Mon, Feb 29, 2016 at 5:08 PM, Sourabh Bhardwaj <bsourabh191@xxxxxxxxx>
> wrote:
>
>> Thanks for the reply Morten,
>>
>> I have tried with order parameter also but still getting the same order.
>> Here suppose I want to sort all the dataelements under Anaemia(KmwPVkjp7yl)
>> group like:
>>
>>
>> https://play.dhis2.org/demo/api/dataElementGroups/KmwPVkjp7yl?fields=dataElements[id,name]&order=name:asc
>>
>> Here output should be:
>>
>> Admission Date
>> Albendazole given at ANC (2nd trimester)
>> Anaemia follow-up
>> Anaemia new
>> Anaemia new
>>
>>
>> But actually it is coming in different order.
>>
>> Thanks.
>>
>>
>>
>>
>> On Mon, Feb 29, 2016 at 3:08 PM, Morten Olav Hansen <morten@xxxxxxxxx>
>> wrote:
>>
>>> I assume you mean metadata (from your examples). Yes, you can use the
>>> order parameter, please have a look at [1].
>>>
>>> [1]
>>> http://dhis2.github.io/dhis2-docs/master/en/developer/html/ch01s06.html
>>>
>>> On Mon, Feb 29, 2016 at 3:48 PM, Sourabh Bhardwaj <bsourabh191@xxxxxxxxx
>>> > wrote:
>>>
>>>> Hi all,
>>>>
>>>> Can we sort data getting through an Api, I am trying using sortOrder
>>>> but it did not helped.
>>>>
>>>> Following is the complete url:
>>>>
>>>>
>>>> https://play.dhis2.org/demo/api/dataElementGroups?fields=dataElements[id,name]&sortOrder=ASC
>>>>
>>>>                                 OR
>>>>
>>>>
>>>> https://play.dhis2.org/demo/api/dataElementGroups?fields=dataElements[id,name]&sortOrder=DESC
>>>>
>>>> Want to sort all the dataelements alphabetically or in some random
>>>> required order which we can define in Api only(say sort by dataelement or
>>>> sort by name etc.)
>>>>
>>>> Thanks & Reagrds,
>>>> Sourabh Bhardwaj.
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>>>>
>>>>
>>>
>>>
>>> --
>>> Morten
>>>
>>
>>
>
>
> --
> Morten
>

References