如下图的例子,EntityB中有一条test1的记录,里面的Connection关联着6条记录
我们想要找出test1里和EntityA这个实体关联的记录都有哪些
最后搜索的结果是这四条
可能有人会问为什么搜出来的不是六条呢?
- 因为有一条虽然它的Connection Role是EntityA,但是Connected To字段是空的,也就是说并没有和任何EntityA实体中的记录进行关联
- 如最上面的图,789这个记录有两条,为什么搜索出来是一条?是因为你搜的是EntityA这个实体里的记录,EntityA实体中叫789的就这一条记录;有789两条记录的是Connection实体中存的记录
附上上面高级查找的FetchXML供参考:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
<entity name="new_entitya">
<attribute name="new_entityaid" />
<attribute name="new_name" />
<attribute name="createdon" />
<order attribute="new_name" descending="false" />
<link-entity name="connection" from="record1id" to="new_entityaid" link-type="inner" alias="ar">
<filter type="and">
<condition attribute="record2id" operator="eq" uiname="test1" uitype="new_entityb" value="{412CB9EE-2FCA-EC11-A7B6-11224816D276}" />
</filter>
</link-entity>
</entity>
</fetch>
参考链接: