我在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>
如果我理解正确,您可以像下面一样更换过滤器以获得结果。
<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查询查询。