如何在基于Fetchxml的报告中的'或'过滤器中使用'in'运算符?

问题描述 投票:0回答:1

我在SSRS for Dynamics 365的基于Fetch的报告中使用了以下xml。我允许@transaction参数为null,但两个参数的其余部分必须具有值。所以,我设置了一个条件,如果@transaction为null或0,那么在1和2的基础上抓住订单。我共有10条记录,但它们没有显示或者报告显示0条记录。知道如何解决这个问题吗?

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
  <entity name="salesorder">
    <attribute name="salesorderid" />
    <attribute name="ordernumber" />
    <order attribute="ordernumber" descending="true" />
    <filter type="and">
      <condition attribute="new_transaction" operator="eq" value="@transaction" />
      <condition attribute="createdon" operator="on-or-before" value="@To" />
      <condition attribute="createdon" operator="on-or-after" value="@From" />
    </filter>
    <filter type="or">
        <condition attribute="new_transaction" operator="in" >
            <value>1</value>
            <value>2</value>
        </condition>
      </filter>
  </entity>
</fetch>
ssrs-2008 dynamics-crm fetchxml dynamics-365 dynamics-crm-365
1个回答
0
投票

如果我理解正确,您可以像下面一样更换过滤器以获得结果。

<filter type="and">
   <condition attribute="createdon" operator="on-or-before" value="@To" />
   <condition attribute="createdon" operator="on-or-after" value="@From" />
   <filter type="or">    
        <condition attribute="new_transaction" operator="in" >
            <value>1</value>
            <value>2</value>
        </condition>
        <condition attribute="new_transaction" operator="eq" value="@transaction" />
   </filter>
</filter>

专业提示: 1.在Advanced查找中创建查询,测试结果并从那里下载fetchxml以用于报表。

2.如果您编写SQL查询,请使用Kingswaysoft sql2fetchxml免费在线转换器将其转换为fetchxml。

3.读取此article将fetchxml转换为Adv查询查询。

© www.soinside.com 2019 - 2024. All rights reserved.