Getting the Item Count

Getting the Item Count

The get count operation returns the number of the result items instead of the items themselves. This can save you bandwidth and client processing.

Simple count

To get items count of a content type, you have to execute the following code snippet:

public async Task GetActivitiesCount(EverliveApp app)
{
    var activitiesCount = await app.WorkWith().Data<Activity>().GetCount().ExecuteAsync();
    Debug.WriteLine(activitesCount);
}

Count plus filtering

You can get filtered items count by executing the following code snippet:

public async Task GetRecentActivitiesCount(EverliveApp app)
{
    var activitiesCount = await app.WorkWith().Data<Activity>().GetCount().Where(activity => activity.CreatedAt > DateTime.Now.AddHours(-1)).ExecuteAsync();
    Debug.WriteLine(activitesCount);
}
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.