Filter 如何将null或空传递给FetchXML筛选器?

Filter 如何将null或空传递给FetchXML筛选器?,filter,dynamics-crm-2011,fetchxml,Filter,Dynamics Crm 2011,Fetchxml,场景:我在Dynamics CRM中有一个关于订单类型的文本字段。该字段与其他一些系统集成,只接受已声明的值列表;例如,ABC、IJK、XYZ等。现在我可以使用高级查找来查询此字段是否包含数据 现在在报告中,我有一个参数,它有所有可能的值和一个附加值“不包含数据”,它的值是空字符串。我还为multi-select启用了此报告参数。但是,如果从报告参数中选择了任何值,则无法获取订单 下面是我的FetchXML查询,请告诉我下面缺少什么 <fetch version="1.0" output-

场景:我在Dynamics CRM中有一个关于订单类型的文本字段。该字段与其他一些系统集成,只接受已声明的值列表;例如,ABC、IJK、XYZ等。现在我可以使用高级查找来查询此字段是否包含数据

现在在报告中,我有一个参数,它有所有可能的值和一个附加值“不包含数据”,它的值是空字符串。我还为multi-select启用了此报告参数。但是,如果从报告参数中选择了任何值,则无法获取订单

下面是我的FetchXML查询,请告诉我下面缺少什么

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
  <entity name="invoicedetail">
   <attribute name="productid" />
    <attribute name="invoicedetailid" />
    <attribute name="tv_ordertype" />
    <order attribute="productid" descending="false" />
    <filter type="and">
        <condition attribute="tv_ordertype" operator="in" value="@Order_Types" />
    </filter>
  </entity>
</fetch>

试试下面的方法

  <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
    <entity name="invoicedetail">
        <attribute name="productid" />
        <attribute name="invoicedetailid" />
        <attribute name="tv_ordertype" />
        <order attribute="productid" descending="false" />      
        <filter type='and'>         
<condition attribute="tv_ordertype" operator="in" value="@Order_Types" />
        </filter>
    </entity>
</fetch>

您的提取XML应该如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
   <entity name="invoicedetail">
      <attribute name="productid" />
      <attribute name="invoicedetailid" />
      <attribute name="tv_ordertype" />
      <order attribute="productid" descending="false" />
      <filter type="and">
         <condition attribute="tv_ordertype" operator="in"/>
            <value>@Order_Types[0]</value>
            <value>@Order_Types[1]</value>
            <!-- etc -->
         </condition>
      </filter>
   </entity>
</fetch>

@订单类型[0]
@订单类型[1]

很遗憾,您无法将值(“ABC”、“IJK”、“XYZ”)与空字符串选项组合。考虑一下SSRS将如何将空字符串解析为FetchXml:

<condition attribute="tv_ordertype" operator="in" value="" />
现在,它将从CRM返回符合您的条件或具有空值的所有值
tv\u ordertype


然后,您可以在tablix/report级别应用额外的筛选

它对我不起作用,结果出现错误:
FetchXML参数“@Order\u Types”无法获取多个值。将参数“@Order\u Types”更改为单值参数,然后重试
我更新了答案,您的参数是否获得了所有的Order\u类型?你能发布你的参数和你的查询的截图吗。什么是“订单类型”?我在FetchXML中找不到任何关于这种类型的变量以@开头的文档。@Shadowfax它来自原始问题对,它在原始问题中,但它是一个有效的变量,还是只是一个占位符?@Shadowfax哦,我想你可以使用逗号分隔的值,但通常情况下是这样的:
option1option2
<filter type="or">
    <condition attribute="tv_ordertype" operator="null" />
    <condition attribute="tv_ordertype" operator="in" value="@Order_Types" />
</filter>