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.
morten
(Morten Hansen)
29 February 2016 09:38
2
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@gmail.com 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@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help : https://help.launchpad.net/ListHelp
–
Morten
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@dhis2.org 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@gmail.com 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@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help : https://help.launchpad.net/ListHelp
Morten
–
morten
(Morten Hansen)
29 February 2016 10:15
4
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@gmail.com 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.
–
Morten
On Mon, Feb 29, 2016 at 3:08 PM, Morten Olav Hansen morten@dhis2.org 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@gmail.com 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@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help : https://help.launchpad.net/ListHelp
Morten
–
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@dhis2.org 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@gmail.com 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.
Morten
–
On Mon, Feb 29, 2016 at 3:08 PM, Morten Olav Hansen morten@dhis2.org 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@gmail.com 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@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help : https://help.launchpad.net/ListHelp
Morten
–