2016-09-07 4 views
1

Пытается создать отчет FetchXML для CRM 2016 с использованием VS2012 следующих инструкций: Create a new report using SQL Server Data Tools. Я хочу просто найти количество дел, созданных между двумя датами.Count Aggregate in FetchXML report

Инструкции по копированию/вставке загруженного FetchXML из CRM Advanced find.

FetchXML порождена Advanced процесса Find перечислить все случаи (по ticketnumber):

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"> 
    <entity name="incident"> 
    <attribute name="incidentid" /> 
    <attribute name="ticketnumber" /> 
    <order attribute="ticketnumber" descending="false" /> 
    <filter type="and"> 
     <filter type="and"> 
     <condition attribute="createdon" operator="on-or-after" value="2015-07-01" /> 
     <condition attribute="createdon" operator="on-or-before" value="2016-06-30" /> 
     </filter> 
    </filter> 
    </entity> 
</fetch> 

Я не могу найти способ агрегирования с Advanced Find, но инструкции здесь: Use FetchXML aggregation, кажется, указывают на пару изменения атрибутов в XML - это все, что необходимо.

Итак, я изменил свое FetchXML в Notepad ++ к:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" aggregate="true" > 
     <entity name="incident"> 
     <attribute name="incidentid" /> 
     <attribute name="ticketnumber" aggregate="count" alias="casecount" /> 
     <order attribute="ticketnumber" descending="false" /> 
     <filter type="and"> 
      <filter type="and"> 
      <condition attribute="createdon" operator="on-or-after" value="2015-07-01" /> 
      <condition attribute="createdon" operator="on-or-before" value="2016-06-30" /> 
      </filter> 
     </filter> 
     </entity> 
    </fetch>

Это приводит к ошибке: Fetch->Sandbox Error

Либо я делаю что-то не так, или что FetchXML Aggregation страница неверна.

Может ли кто-нибудь показать мне, как создать отчет fetchXML, который учитывает случаи, открытые между двумя датами?

ответ

0

Вы не можете выбрать атрибут (incidentid), в то же время делая агрегацию.

Кроме того, применение заказа не имеет смысла, когда вы агрегируете.

Я удалил эти две линии, после чего FetchXML может работать:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" aggregate="true" > 
    <entity name="incident"> 
    <attribute name="ticketnumber" aggregate="count" alias="casecount" /> 
    <filter type="and"> 
     <filter type="and"> 
     <condition attribute="createdon" operator="on-or-after" value="2015-07-01" /> 
     <condition attribute="createdon" operator="on-or-before" value="2016-06-30" /> 
     </filter> 
    </filter> 
    </entity> 
</fetch> 

В качестве побочного сведению, вы можете использовать FetchXml Tester в XrmToolBox для быстрого возможность редактирования и выполнить FetchXML.

+0

спасибо. Это выполнило эту работу, как только я воссоздал отчет в VS. Я не уверен, как был выбран случайный случай, я просто использовал продвинутую находку, и он дал мне эти поля. – mcalex