我有一个fetchxml,在将另一个属性添加到fetch之前,它可以正常工作。
<attribute name="ey_b_closed_conversations" alias="isClosed" />
这是我添加到提取中的行,现在不起作用。以下代码是完整的fetchxml。
<fetch mapping="logical" version="1.0" aggregate="true" distinct="false">
<entity name="ey_case_branch_callcenter_inquiry">
<attribute name="ey_s_name" alias="count" aggregate="countcolumn" />
<attribute name="ey_p_action" alias="id" groupby="true" />
<attribute name="ey_b_closed_conversations" alias="isClosed" />
<filter>
<condition attribute="ey_case_sub_subjectid" operator="eq" value="{9E52CB8E-BEA6-E411-AFFF-0050568C0143}" />
<condition attribute="statecode" operator="eq" value="0" />
</filter>
</entity>
</fetch>
我可以在聚合的fetchxml中获取的属性数量是否有限制?如何将我的其他(非聚合)属性添加到提取中?
我可以在聚合的fetchxml中获取的属性数量是否有限制?
编号
如何将我的其他(非聚合)属性添加到提取中?
您不能。
您可能已经收到此错误:An attribute can not be requested when an aggregate operation has been specified and its neither groupby nor aggregate.
这类似于SQL错误:Column 'xxxx' is invalid in the select list because it is not
contained in either an aggregate function or the GROUP BY clause.
出现此错误是因为查询的以下行在该行中没有groupby
或aggregate
属性。
<attribute name="ey_b_closed_conversations" alias="isClosed" />
这是因为当您进行分组时,您只能包含未分组的属性(例如,总和/最小/最大/计数)
我测试了以下内容,并且有效:
<fetch mapping="logical" version="1.0" aggregate="true" distinct="false" >
<entity name="account" >
<attribute name="name" alias="count" aggregate="countcolumn" />
<attribute name="telephone2" alias="phone" groupby="true" />
<attribute name="accountnumber" alias="number" groupby="true" />
<filter>
<condition attribute="statecode" operator="eq" value="0" />
</filter>
</entity>
</fetch>