Is it possible to limit the number of results returned in response when using QueryExpression in CRM 4

I basically have a QueryExpression expression that returns over 3000 results. I only need to use 50 to 200 of them. If I used regular sql, I could use SELECT TOP 200 ..... Is there a way to do this in CRM using QueryExpression or FetchXML?

+8
dynamics-crm fetchxml
source share
2 answers

In the QueryExpression expression:

QueryExpression query = new QueryExpression(); query.PageInfo = new PagingInfo(); query.PageInfo.Count = 200; // or 50, or whatever query.PageInfo.PageNumber = 1; 

In Fetch XML:

 <fetch mapping='logical' page='1' count='200'> ... 
+18
source share

@Matt basically said it right. This article extends his answer.

Essentially, you want to use PageInfo for QueryExpression. This way you can limit the results or, even better, select more than 5000 rows (default limit). PageInfo is used as a paging indicator. How many lines a page contains, how many pages and most importantly, PagingCookie is used to recursively read more data (more than 5 thousand lines) https://msdn.microsoft.com/en-us/library/mt269606.aspx

-one
source share

All Articles