簡體   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