top

open fun top(count: Int): DataQuery

Set {@link com.sap.cloud.mobile.kotlin.odata.DataQuery#topCount DataQuery.topCount} to specify the maximum number of results to return.

Example using proxy classes:
open fun queryWithTopExample(): kotlin.Unit
{
    val service = this.service;
    val query = DataQuery().top(10);
    val customers = service.getCustomers(query);
    this.showCustomers(customers);
    Assert.isTrue(customers.size == 10,
        "/Users/home/xmkbuilder/data/jenkins/prod-build7010/w/a1o59enhtx/src/main/xs/examples/example.NorthwindProxyClient.xs:466:9");
}
Example using dynamic API:
open fun queryWithTopExample(): kotlin.Unit
{
    val service = this.service;
    val customersEntitySet = service.getEntitySet("Customers");
    val query = DataQuery().from(customersEntitySet).top(10);
    val customers = service.executeQuery(query).getEntityList();
    this.showCustomers(customers);
    Assert.isTrue(customers.length == 10,
        "/Users/home/xmkbuilder/data/jenkins/prod-build7010/w/a1o59enhtx/src/main/xs/examples/example.NorthwindClient.xs:509:9");
}

Return

This query.

Parameters

count

Maximum number of results for query execution to return.