【问题标题】:Filter to count number of entities with null value in a specific field in a link-entity过滤以计算链接实体中特定字段中具有空值的实体数
【发布时间】:2019-08-02 15:15:05
【问题描述】:

我在 CRM Dynamics 中创建了一个图表,需要显示 2 列,一列显示尚未联系的潜在客户数量,另一列显示已联系的潜在客户数量。后一个工作正常,但我不知道如何制作一个计算空值的过滤器。

<fetch mapping="logical" aggregate="true">
    <entity name="lead">
        <attribute name="entitiy1" groupby="true"alias="_CRMAutoGen_groupby_column_Num_0" />
            <link-entity name="lead" from="leadid" to="leadid" link-type="outer">
               <attribute alias="_CRMAutoGen_aggregate_column_Num_0" name="number_of_interactions" aggregate="countcolumn" distinct="true" />
               <filter type="and">
               <filter type="or">
                   <condition attribute="number_of_interactions" operator="eq" value="0"  />
                   <condition attribute="number_of_interactions" operator="null" />
               </filter>
               </filter>
          </link-entity>
          <link-entity name="lead" from="leadid" to="leadid" link-type="outer">
              <attribute alias="_CRMAutoGen_aggregate_column_Num_13" name="number_of_interactions" aggregate="countcolumn" distinct="true" />    
              <filter type="and">
                  <condition attribute="number_of_interactions" operator="ge" value="1" />
              </filter>
              </link-entity>
   </entity>
</fetch>```

【问题讨论】:

    标签: dynamics-crm fetchxml


    【解决方案1】:

    您能否更详细地解释您的代码试图做什么,即为什么您要创建两个从线索到线索的链接实体?

    在我看来,您当前的代码相当于:

    select l1.entitiy1 = [some aggregate value related to number_of_interactions]
    from lead l1
    left join lead l2 on l1.leadid = l2.leadid
    left join lead l3 on l1.leadid = l3.leadid
    where (l2.number_of_interactions is null or l2.number_of_interactions = 0)
    and l3.number_of_interactions >= 1
    group by l1.entitiy1
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-02
      • 2018-07-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多