Does anyone know of any sample code that uses the sortexpression class. I need to read orders sorted by customer, and assume the sortexpression class is the way to do it, but can't get the syntax right as there are no samples available.
Does anyone know of any sample code that uses the sortexpression class. I need to read orders sorted by customer, and assume the sortexpression class is the way to do it, but can't get the syntax right as there are no samples available.
I have figured it out! Please see the code snippet below:
Dim lobjCustomerList As CustomerList
Dim SortExp As SortExpression
Dim modifiers As LoadModifiers
SortExp = SortExpression.OrderByAscending("Customer.ID")
lobjCustomerList = lobjCompany.Factories.CustomerFactory.List()
Dim sortlist As SortExpressionList
modifiers = LoadModifiers.Create()
sortlist = modifiers.Sorts
sortlist.Add(SortExp)
lobjCustomerList.Load(modifiers)
If lobjCustomerList.Count > 0 Then
For Each lobjCustomer In lobjCustomerList
Debug.WriteLine(lobjCustomer.ID)
Next
End If
Hopefully this will help someone else out in the future.
Graham
*Community Hub is the new name for Sage City