我正在尝试计算有活动的联系人数量。我只检索我的 FetchXML“全名”中的一个属性,并应用了聚合函数“计数”。我还有一个与 ActivityParty 的链接实体,以确保该联系人在该表中有数据。
我的问题是返回的“全名”并不明显,因为 FetchXML 根据他的活动数量重复每个联系人。我无法通过在我的 fetchXML 中使用“distinct=true”来解决这个问题,因为返回的“count(fullname)”总是不同的。
如何让 FetchXML 在应用计数之前返回不同的全名?
这是我的代码:
<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true' aggregate='true'>
<entity name='contact'>
<attribute name='fullname' aggregate='count' alias='countcontact' />
<filter type='and'>
<condition attribute='new_lasttouched' operator='null' />
</filter>
<link-entity name='activityparty' from='partyid' to='contactid' alias='am'>
<filter type='and'>
<condition attribute='participationtypemask' operator='in'>
<value>4</value>
<value>3</value>
<value>6</value>
<value>5</value>
<value>1</value>
<value>2</value>
</condition>
</filter>
</link-entity>
</entity>
</fetch>