Try our conversational search powered by Generative AI!

OrderByClause value to sort by decreasing value

Vote:
 

Good afternoon

I'm trying to sort the result of an order query. Currently there is a .SqlMetaWhereClause() before de .FindPurchaseOrders() call and it's working fine. I'm reading the developpers guide and I saw a parameter named OrderByClause to sort the result.

Unfortunatly there is nothing much in the documentaton about what value needs to be assigned to achieve the result expected. I would like to sort orders by creationDate older first.

I'm using Commerce 8 and a migration process to 11 is ongoing. If I could have an answer for both version, it would be appreciated.

I'm wondering if someone could help or point me examples.

Regards

#197503
Oct 04, 2018 21:45
Vote:
 

I will need to double check to be 100% sure, but top of my head, you can asssign <fieldname> if the field is in OrderGroup class (corresponding to OrderGroup table) and "META.<fieldname>" if the field is in PurchaseOrder class (corresponding to OrderGroup_PurchaseOrder table), that applies to your custom fields as well

#197511
Oct 05, 2018 8:01
Vote:
 

And you can use DESC or ASC, so for example, if you want to get the latest created orders, use "OrderGroupId DESC" 

#197513
Oct 05, 2018 8:37
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.