如何在FetchXml中使用distinct而不会产生不明确的结果?

问题描述 投票:1回答:1

当我有以下FetchXml时,如何应用distinct ='true'?它是仅仅引用主要实体记录还是应该返回一条记录?或者给出4个与链接实体过滤器匹配的链接实体记录,它应该返回4条记录(即,应该是不同的 - 是否引用完整的查询)?

我无法找到任何涵盖此内容的文档,也没有在SO上找到类似的内容。

<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>
  <entity name='primary-entity'>
    <attribute name='primary-entity-id />
    <attribute name='an-attribute'/>
    <filter type='and'>
      <condition attribute='an-attribute' operator='eq' value='something' />
    </filter>
    <link-entity name='linked-entity' from='primary-entity' to='primary-entity-id' alias='le'>
      <filter type='and'>
        <condition attribute='an-attribute' operator='in'>
          <value>1</value>
          <value>2</value>
          <value>3</value>
          <value>4</value>
        </condition>
      </filter>
    </link-entity>
  </entity>
</fetch>
dynamics-crm distinct fetchxml
1个回答
0
投票

“distinctness”是指完整查询,或者更确切地说是查询返回的所有属性。因此,如果您的情况下的链接实体记录不返回任何属性,实际上distinct应该仅“覆盖”主要实体。

© www.soinside.com 2019 - 2024. All rights reserved.