简体   繁体   English

fetchXml CRM中的if-else子句

[英]If-else clause in fetchXml CRM

I want to get data from two tables deal and details. 我想从两个表的交易和详细信息中获取数据。 I could make join and fetch data but I couldn't figure out how to link-entity on a condition. 我可以进行联接和获取数据,但是我不知道如何在条件下链接实体。 In simple terms, I want 简单来说,我要

if deal.sell is yes:
    fetch details
else:
    fetch deal

The xml below links and fetches some attributes of details , how can I insert the if else clause to this?(if its possible) 下面的xml链接并获取了details的一些属性,如何在其中插入if else子句?(如果可能)

<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>
  <entity name='deal'>
    <attribute name='createdon' />
    <attribute name='statecode' />
    <attribute name='dealsid' />
    <link-entity name='details' from='detailsid' to='deal_detail' >
       <attribute name='description' />
    </link-entity>
  </entity>
</fetch>

There is no way of doing that using FetchXml. 使用FetchXml无法做到这一点。 You will have to think about other way of implementing your requirement. 您将不得不考虑实现需求的其他方式。

You deal with this by having multiple joins, one for each if/else 您可以通过多个连接来处理此问题,每个if / else一个连接

Using Pesduo code: 使用Pesduo代码:

 From deal
 Outer Join Details on Deal.Id = Details.Id
 Outer Join Deal on Deal.Id = Deal.ParentDealId

Then you'd do the work on the client side to figure out what you need, and what you don't. 然后,您需要在客户端上进行工作,以了解您需要什么,不需要什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM