Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

OrderBy not working #179

Open
fireball147 opened this issue Jan 31, 2022 · 2 comments
Open

OrderBy not working #179

fireball147 opened this issue Jan 31, 2022 · 2 comments

Comments

@fireball147
Copy link

I tried using OrderBy in query to sort the list based on ID in descending order, but it still pulls data in ascending order. Am I doing something wrong?

the code I used is as below:
query = {"OrderBy":[("ID","DESCENDING")]}
print(list_items = my_list.get_list_items(query=query, row_limit=100))

I also checked list.py file in the code package, and I didn't see there any code lines related to OrderBy.
The file has if "Where" in query part, but it doesn't has anything for OrderBy.

Am I missing something here?

@oederp1
Copy link

oederp1 commented Feb 1, 2022

The same problem occurs here...
I tried order by ID but it still pulls data in ascending order...

@fireball147
Copy link
Author

I found the solution for it. I edited the list.py and added the below lines to it just below the "Where" part of code (at line 248)


If "OrderBy" in query:
modified_query["OrderBy"] = query["OrderBy"]

This should fix the problem. Be careful of the indentation. This should be at same level as the previous if "Where" in query: condition for it to work properly.

Let me know if it works.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants