问题描述
我正在使用FetchXml查询CRM 4.0。我们有一个特殊情况,要求CRM实体之间进行复合联接。 指示允许多个链接实体元素,并且还指示多个过滤器/ condition元素可以添加到链接实体。我面临的问题是condition元素的value属性似乎不允许使用实体/列名称。它期望一个显式声明的值。
I am using FetchXml to query CRM 4.0. We have a special case that will require a composite join between CRM entites. The FetchXml schema indicates that multiple link-entity elements are allowed, and it also indicates that multiple filter/condition elements can be added to a link-entity. The problem I'm facing is that the value attribute of the condition element does not appear to permit an entity/column name. It expects an explicitly declared value.
例如,FetchXml允许您指定以下内容:
For example, FetchXml lets you specify this:
<link-entity name='myentity' from='column1' to='column2'/>
...这与T-SQL等效:
... which does the T-SQL equivalent of this:
JOIN myentity on column1 = column2
并且它允许您指定以下内容:
And it lets you specify this:
<link-entity name='myentity' from='column1' to='column2'>
<filter type='and'>
<condition attribute='column3' operator='eq' value='myvalue' />
</filter>
</link>
...与T-SQL等效:
... which is the T-SQL equivalent of this:
JOIN myentity on column1 = column2 AND column3 = 'myvalue'
但是,不会出现
FetchXml以提供与此等效的内容:
FetchXml does not appear, however, to provide an equivalent of this:
JOIN myentity on column1 = column2 AND column3 = column4
请注意区别。 FetchXml提供了联接中的条件,但它似乎确实提供了复合联接,即跨多个列的联接。
Note the difference. FetchXml provides for conditions in the join, but it does appear to provide for a composite join, that is, a join across multiple columns.
网络空间中有人在吗?能够在CRM 4.0中使用FetchXml执行复合联接?谢谢!
Has anyone out there in cyberspace been able to perform a composite join using FetchXml in CRM 4.0? Thanks!
更多信息:
我正在寻找一个使用FetchXml完成此任务的答案-而不是SQL或QueryExpression语法。上面的SQL只是用来解释概念。
I'm hunting an answer that uses FetchXml to accomplish this - not SQL or the QueryExpression syntax. The SQL above is there just to explain the concept.
推荐答案
不,它不允许这样做。当涉及到非基本的连接时,提取XML受到很大的限制。如果我很好奇,我通常使用。
No, it doesn't permit this. Fetch XML is pretty limited when it comes to anything non-basic in joins. If I'm curious I usually test my query using Stunnware Tools. If it is not exposed there it probably can't be done.
不幸的是,在这种情况下,我通常最终会(被迫)采用多查询方法
Unfortunately, in situations like these these I usually end up (am forced into) taking a multiple query approach to the problem.
我知道您说您对此不感兴趣-但我很确定QueryExpression也不会处理它。以我的经验,它仅提供fetchxml功能的一部分。
I know you said you're not interested in this - but I'm pretty sure QueryExpression won't handle it either. In my experience it only offers a subset of the fetchxml functionality.
这篇关于使用Microsoft Dynamics CRM 4.0中的FetchXml是否可以进行复合联接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!