shareplum icon indicating copy to clipboard operation
shareplum copied to clipboard

OrderBy not working

Open fireball147 opened this issue 3 years ago • 2 comments

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?

fireball147 avatar Jan 31 '22 18:01 fireball147

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

oederp1 avatar Feb 01 '22 01:02 oederp1

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.

fireball147 avatar Feb 01 '22 05:02 fireball147