Sorting

Sorting

Telerik Platform can return query results in sorted order: ascending or descending. All processing is performed on the server, saving you the additional operations on the client.

Ascending

You can retrieve items sorted in ascending order by a field by executing the following code snippet:

EVFetchRequest *request = [EVFetchRequest fetchRequestWithKindOfClass:[Items class]];
NSMutableArray* sortDescriptors = [[NSMutableArray alloc]init];
[sortDescriptors addObject:[NSSortDescriptor sortDescriptorWithKey:@"Price" ascending:YES]];
[request setSortDescriptors:sortDescriptors];
[dataStore executeFetchRequest:request target:self selector:@selector(expectSortedAscendingByRating:error:)];

Descending

You can read items sorted in descending order by altering the NSSortDescriptor ascending parameter:

[sortDescriptors addObject:[NSSortDescriptor sortDescriptorWithKey:@"Rating" ascending:NO]];
Start a free trial Request a demo
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.