Dynamics 365 Fetch XML - Используйте оператор IN для строки - PullRequest
0 голосов
/ 07 января 2020

Поскольку мне нужно создать запрос, в котором мне нужно добавить условие фильтра, где допустимый тип сущности может быть любым из e1, e2, e3.

Для этого я сейчас написал ниже Fetch XML:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" top="5000">
  <entity name="changelog" >
    <filter type="and" >
      <condition attribute="statecode" operator="eq" value="0" />
      <condition attribute="event" operator="eq" value="Delete" />
      <filter type="or" >
        <condition attribute="entitytype" operator="eq" value="email" />
        <condition attribute="entitytype" operator="eq" value="fax" />
        <condition attribute="entitytype" operator="eq" value="letter" />
        <condition attribute="entitytype" operator="eq" value="phonecall" />
      </filter>
    </filter>
    <order attribute="statuscode" />
    <order attribute="event" />
    <order attribute="createdon" />
  </entity>
</fetch>

Выше запрос передает ожидаемые записи.

Но, я полагаю, для этого может быть и другой подход - с помощью оператора IN для условия типа объекта.

Для проверки этого запроса я использую XRMTool Fetch XML Tester , который выдает ошибку. Запрос выглядит следующим образом:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" top="5000">
  <entity name="changelog" >
    <filter type="and" >
      <condition attribute="statecode" operator="eq" value="0" />
      <condition attribute="event" operator="eq" value="Delete" />
            <condition attribute="entitytype" operator="in" >
                <value>
                    phonecall
                </value>
                <value>
                    email
                </value>
                <value>
                    fax
                </value>
                <value>
                    letter
                </value>
            </condition>
        </filter>
        <order attribute="statuscode" />
        <order attribute="event" />
        <order attribute="createdon" />
    </entity>
</fetch>

Приведенный выше запрос не возвращает никаких записей в результате.

Примечание : я отформатировал это с помощью Fetch XML Кнопка Формат тестеров.

Любая помощь?

1 Ответ

0 голосов
/ 07 января 2020

Причиной была опция формата по умолчанию, предоставляемая Fetch XML Tester .

Способ форматирования Fetch XML был причиной, по которой он не возвращал никакого значения.

Предполагается отформатировать, как показано ниже:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" top="5000">
  <entity name="changelog" >
    <filter type="and" >
      <condition attribute="statecode" operator="eq" value="0" />
      <condition attribute="event" operator="eq" value="Delete" />
            <condition attribute="entitytype" operator="in" >
                 <value>phonecall</value>
                 <value>email</value>
                 <value>fax</value>
                 <value>letter</value>
            </condition>
        </filter>
        <order attribute="statuscode" />
        <order attribute="event" />
        <order attribute="createdon" />
    </entity>
</fetch>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...