Progress will discontinue Telerik Platform on May 10th, 2018. Learn more

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:

public ArrayList<Book> GetBooks(EverliveApp app) {
    SortingDefinition sortAsc = new SortingDefinition("CreatedAt", SortDirection.Ascending);
    RequestResult<ArrayList<Book>> requestResult = app.workWith().data(Book.class).get().sort(sortAsc).executeSync();
    return requestResult.getSuccess() ? requestResult.getValue() : null;
}

Descending

You can read items sorted in descending order by a field by executing the following code snippet:

public ArrayList<Book> GetBooks(EverliveApp app) {
    SortingDefinition sortAsc = new SortingDefinition("CreatedAt", SortDirection.Descending);
    RequestResult<ArrayList<Book>> requestResult = app.workWith().data(Book.class).get().sort(sortAsc).executeSync();
    return requestResult.getSuccess() ? requestResult.getValue() : null;
}
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.