根据参数值修改Fetchxml查询。

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

下面是我的XML rdl报告,其中@AccountType是一个选项值列表,为1(特许经营),2(客户),3(两者)

<DataSet Name="dtaReport">
  <Query>
    <DataSourceName>dsOpenWorksCRM</DataSourceName>
    <QueryParameters>
     <QueryParameter Name="@AccountType">
        <Value>=Parameters!AccountType.Value</Value>
        <rd:UserDefined>true</rd:UserDefined>
      </QueryParameter>
    </QueryParameters>
<CommandText>
      &lt;fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true"&gt;
      &lt;entity name="account"&gt;
      &lt;attribute name="name" /&gt;
      &lt;attribute name="accountid" /&gt;
      &lt;filter type="and"&gt;
      &lt;condition attribute="plus_accounttype" operator="eq" value="@AccountType" /&gt;
      &lt;/filter&gt;
      &lt;/entity&gt;
      &lt;/fetch&gt;
    </CommandText>

如果我选择1或2,那么上面的查询就能正常工作,如果我选择3,我需要改变上面的查询,它同时返回1和2类型的记录。我猜想写一个if条件来改变上面的操作符为 "in",如果我选择3,但不知道如何实现这一点任何帮助?

sql dynamics-crm crm rdl fetchxml
1个回答
0
投票

你可以添加一个多选择下拉菜单,这个参数可以和以下参数一起使用。in 操作符的fetchxml查询。

你必须检查设置 - "允许多个值"。阅读更多

enter image description here

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