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

后端 未结 2 625
梦如初夏
梦如初夏 2020-12-20 16:30

Basically I have a QueryExpression that returns over 3000 results. I only need to use between 50 and 200 of these. If I was using normal sql I could use SELECT TOP 200.....

相关标签:
2条回答
  • 2020-12-20 16:44

    @Matt basically said everything right. This article expands on his answer.

    What you essentially want to do is use PageInfo prop of QueryExpression. That way you can limit the results, or, even better fetch more than 5000 rows (default limit). PageInfo is used as a paging indicator. How many rows does a page have, how many pages and most important, PagingCookie used for recursive read of more data (more than 5k rows) https://msdn.microsoft.com/en-us/library/mt269606.aspx

    0 讨论(0)
  • 2020-12-20 16:58

    In a QueryExpression:

    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'>
    ...
    
    0 讨论(0)
提交回复
热议问题