FetchXMLを使用しており、2つのエンティティのカウントをグループ化して使用していますが、グループ化する必要のない残りのエンティティは、データをプルダウンするだけで済みます。たとえば、これは私のコードです:
string groupby1 = @"
<fetch distinct='false' mapping='logical' aggregate='true'>
<entity name='opportunity'>
<attribute name='name' alias='opportunity_count' aggregate='countcolumn' />
<attribute name='ownerid' alias='ownerid' groupby='true' />
<attribute name='createdon' alias='createdon' />
<attribute name='customerid' alias='customerid' />
</entity>
</fetch>";
EntityCollection groupby1_result = orgProxy.RetrieveMultiple(new FetchExpression(groupby1));
foreach (var c in groupby1_result.Entities)
{
Int32 count = (Int32)((AliasedValue)c["opportunity_count"]).Value;
string OwnerID = ((EntityReference)((AliasedValue)c["ownerid"]).Value).Name;
DateTime dtCreatedOn = ((DateTime)((AliasedValue)c["createdon"]).Value);
string CustomerName = ((EntityReference)((AliasedValue)c["customerid"]).Value).Name;
}
しかし、私はこのエラーを受け取ります:
例外:System.ServiceModel.FaultException`1 [Microsoft.Xrm.Sdk.OrganizationServiceFault]:集約操作が指定されており、groupbyでもaggregateでもない場合、属性を要求できません。NodeXml :(障害の詳細はMicrosoft.Xrm.Sdk.OrganizationServiceFaultと同じです)。
一部の値で集計を使用し、他の値では使用しない方法を教えてください。