I have implemented the FunctionExpression class as described in other threads. However I cannot figure out how to apply this to a sort expression, as the SortClauseFactory.Create only seems to accept a field index, rather than a field entity...
Dim SortFunction As New FunctionExpression(EntityFieldFactory.Create(ProductFieldIndex.Nng), "LEN")
Dim SortField As IEntityField2 = ProductFields.Nng.SetExpression(SortFunction)
ProductsSort.Add(SortClauseFactory.Create(SortField, SortOperator.Descending))
The last line is incorrect. Any more ideas how I can implement this ?