shareplum
shareplum copied to clipboard
OrderBy not working
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?
The same problem occurs here... I tried order by ID but it still pulls data in ascending order...
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.