Using OData with Queries That are Set with a Top Number of Rows - Business Central (2024)

Table of Contents
In this article See Also

Business Central queries include the TopNumberOfRows Property and TopNumberOfRows Method that can be used to specify the maximum number of rows to include in the resulting dataset. The Business Central Server includes the Max Page Size setting for OData that specifies the maximum number of entities returned per page of OData results. The default value is 20,000.

To ensure that the OData results include the correct number of entities when you are using a query that is set with a top number of rows, you should set the Max Page Size value greater than the value that is set by the TopNumberOfRows property and TopNumberOfRows method. Otherwise, the TopNumberOfRows property and TopNumberOfRows method are ignored and the query dataset will be returned in the OData results.

Typically, the TopNumberOfRows property or TopNumberOfRows method are used to return a relatively small number of entities, such as the top five, ten, or 100 entities. Therefore, in most cases, the value of the TopNumberOfRows property and TopNumberOfRows method will be less than the Max Page Size, so that you will not have to change the Max Page Size setting.

Tip

In HTTP requests, it can be beneficial to use odata.maxpagesize instead of the system query options $top and $skip. For instance, odata.maxpagesize automatically includes nextlink in the response, which lets you continuously retrieve a large dataset in limited chunks.

For information about how to change the Max Page Size setting, see Configuring Business Central Server and Server-Driven Paging in OData Web Services.

See Also

Basic Page Operations

Using OData with Queries That are Set with a Top Number of Rows - Business Central (2024)
Top Articles
Latest Posts
Article information

Author: Domingo Moore

Last Updated:

Views: 5993

Rating: 4.2 / 5 (73 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Domingo Moore

Birthday: 1997-05-20

Address: 6485 Kohler Route, Antonioton, VT 77375-0299

Phone: +3213869077934

Job: Sales Analyst

Hobby: Kayaking, Roller skating, Cabaret, Rugby, Homebrewing, Creative writing, amateur radio

Introduction: My name is Domingo Moore, I am a attractive, gorgeous, funny, jolly, spotless, nice, fantastic person who loves writing and wants to share my knowledge and understanding with you.