为什么fetchXml count属性没有限制返回的记录?

Why isn't he fetchXml count attribute limiting the records returned?

本文关键字:返回 记录 有限制 fetchXml count 属性 为什么      更新时间:2023-09-26

我有一个javascript函数,它使用fetchXML向控件添加一个自定义视图。我的问题是根<fetch>节点上的计数属性不起作用。我将其设置为6,但它返回26条记录(所有记录),由fetch定义。

fetchXML

<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false' count='6'>
  <entity name='xyz_entity'>
    <attribute name='xyz_entityname' />
    <attribute name='xyz_startdate' />
    <attribute name='xyz_enddate' />
    <attribute name='xyz_currententity' />
    <attribute name='xyz_inactiveentity' />
    <order attribute='xyz_currententity' descending='true' />
    <order attribute='xyz_startdate' />
    <filter type='or'>
      <condition attribute='xyz_currententity' operator='eq' value='1' />
      <filter type='and'>
        <condition attribute='xyz_startdate' operator='ge' value='2011-11-01' />
        <condition attribute='xyz_enddate' operator='gt' value='2011-11-01' />
      </filter>
    </filter>
  </entity>
</fetch>

fetchXML在javascript中是这样使用的:

Xrm.Page.getControl("itt_termid").addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, true);

但是当用户单击查找图标时,返回全部26条记录,而不是6条。

您是否尝试显式指定页码(如1)?

之类的
<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'     page='1' count='6'>

这似乎是CRM 2011的自定义视图中的一个错误。它也不支持本页面引用的order by: http://social.microsoft.com/Forums/en/crmdevelopment/thread/81537133-b3a7-457b-a257-b745b30ca98e

用户可以指定他们想要每页显示多少条记录,并且由于控件必须自己进行分页,我的猜测是它正在用自己的计数替换您的计数。如果您在查找视图的上下文之外运行此fetch,它是否正确地限制了计数?