Take the community feedback survey now.
Take the community feedback survey now.
Hi Matthew
The Created column is in the PurchaseOrder table. You can filter by it using the SqlMetaWhereClause.
But there is no such ordering clause for that table.
However, as I recall, the result is ordered by the object ID, which is sequential and can be used as a stand-in for the Created date (if you need ascending order).
OrderByClause works with CustomerName, because that field is in the OrderGroup table.
Hi Stefan,
Thanks for the response, but I'm specifically interested in the documented OrderByClause as I need to control the sorting of the results (within pagination).
I have realised (and is documented) that it orders by the OrderGroup.OrderGroupId DESC which makes sense for many use cases. But I actually need to sort by another column that has been added to the OrderGroup_PurchaseOrder. My example of using the META.Created DESC is just to test if even an out of the box column would work - and also be common to discuss with other devs since it's known. Ultimately I need it to use another column anyway which is not going to be consistent with the OrderGroup.OrderGroupId, unfortunately.
So I don't think SqlMetaWhereClause or the default order helps in my use case.
Ideally, I'm just wanting to use the OrderByClause as documented and as I've explained using the META column ordering.
Is there any reason you say "there is no such ordering clause for that table"? Or is it just that you've also discovered it doesn't work as designed, like I have now?
Matt
Update: I have just updated all packages so I'm running EPiServer.Commerce v13.37.2 and the same issue remains. From digging around, it seems clear this issue is specifically with the stored procedure "ecf_Search_PurchaseOrder" (and it's subsequent called stored procedures). This definitely seems like it should work, and this appears to be some sort of bug - especially when considering the documentation. Here's an example error down at the SQL execution level:
Hi, the documentation is wrong and inconsistent. It stated that "
OrderByClause
– This clause can use only OrderGroup
table fields. If this field is not set, OrderGroupId
is used.which is correct. I will file a bug to correct a documentation. Thank you for brining this into our attention and apologies for the inconvenience.
OrderByClause
to reference META columns (on theOrderGroup_PurchaseOrder
table).Created
, it throws an exception:OrderByClause = "CustomerName DESC"