Udostępnij za pośrednictwem


Using OData with Queries That are Set with a Top Number of Rows

Microsoft Dynamics NAV queries include the TopNumberOfRows Property and TOPNUMBEROFROWS Function that can be used to specify the maximum number of rows to include in the resulting dataset. The OData configuration includes the Max Page Size setting that specifies the maximum number of entities returned per page of OData results. The default value is 1000.

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 function. Otherwise, the TopNumberOfRows property and TOPNUMBEROFROWS function are ignored and the query dataset will be returned in the OData results.

Note

Typically, the TopNumberOfRows property or TOPNUMBEROFROWS function 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 function will be less than the Max Page Size, so that you will not have to change the Max Page Size setting.

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