FetchXML:根据链接实体的字段获取记录数 [英] FetchXML: get count of records based on a field of a linked entity

查看:365
本文介绍了FetchXML:根据链接实体的字段获取记录数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一种情况,我想从一个实体中获得人口数量,该实体的多个位置地址被标记为其他链接实体中的当前地址。

I have a scenario where i want to get the count of people from an Entity who have multiple location address marked as current address in other linked entity.

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" aggregate="true">
<entity name="client">
<attribute name="clientid"/>
<attribute name="name"/>
<attribute name="createdon"/>
<order attribute="name" descending="false"/>
<link-entity name="locationadd" from="clientid" to="clientid" alias="aa">
  <attribute name="locationadd" aggregate="countcolumn" />
  <filter type="and">
    <condition attribute="isthiscurrentadd" operator="eq" value="1"/>
  </filter>
  </link-entity>
  </entity>
</fetch>


推荐答案

答案是

<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true' aggregate='true'> 
<entity name='client'> 
<attribute name='clientid' alias='PersonName' groupby='true' /> 
<link-entity name='locationadd' from='clientid' to='clientid' alias='aa'> 
<attribute name='isthiscurrentadd' alias='Count' aggregate='count'/> 
<filter type='and'> 
<condition attribute='isthiscurrentadd' operator='eq' value='1'/> 
</filter> 
</link-entity> 
</entity> 
</fetch>

这篇关于FetchXML:根据链接实体的字段获取记录数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆