Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Hi,
I am trying to sort some objects by a nesten field, but cannot seem to get it working. I would like to sort all the results, (each containing the EnumerableField) based on the first element matching the z-lambda function of all the elements.
This is the nested sorting function I am using, which produces a "EPiServer.Find.ServiceException: 'The remote server returned an error: (400) Bad Request".
:
search.OrderBy(x => x.EnumerableField, y => y.DecimalNumber, z => z.ValidTo.After(DateTime.Now) & z.IsActive.Match(true) & z.ValidFrom.Before(DateTime.Now));
I have also tested sorting with .FirstOrDefault(...) but to no avail. As opposed to the previous approach, this one does not seem to do anything:
Is there something I am missing, or is this not possible?
The find-index objects is grouped in this way:
{ "MetaClassId$$number": .., "GetTimestamp$$date": .., ..., "EnumerableField": [ { "___types": [ "...", "System.Object" ], "DecimalNumber$$number": 0.9, "ValidFrom$$date": "2019-01-02T23:00:00Z", "ValidTo$$date": "2019-10-17T22:00:00Z", "Title$$string": "...", "ID$$number": 1, "$type": "....Core", "IsActive$$bool": true }, { "___types": [ "...", "System.Object" ], "DecimalNumber$$number": 0.2, "ValidFrom$$date": "2019-01-02T23:00:00Z", "ValidTo$$date": "2019-10-17T22:00:00Z", "Title$$string": "...", "ID$$number": 1, "$type": "....Core", "IsActive$$bool": true }, ], ... "IsPendingPublish$$bool": false, }