繁体   English   中英

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

[英]How to use 'in' operator in 'or' filter in Fetchxml based report?

我在 SSRS for Dynamics 365 的基于 Fetch 的报告中使用以下 xml。我已允许@transaction参数为空,但其余两个参数必须具有值。 因此,我设置了一个 or 条件,以便如果@transaction为 null 或 0,则在 1 和 2 的基础上获取订单。 我总共有 10 条记录,但它们没有显示或报告 preivew 显示 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>

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

<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.在高级查找中构建查询,测试结果并从那里下载 fetchxml 以在报告中使用。

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

3.阅读本文将fetchxml转换为Adv find查询。

<filter type="or">
  <condition attribute="new_transaction" operator="in" value=@parm>
  </condition>
</filter>

*为多个值工作

暂无
暂无

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

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