CRM动态:oData字符串javascript [英] CRM dynamics: oData string javascript
问题描述
想象两个表:
TABLE A |TABLE B
Entity |Id
Id |name
Points |Ranking
如何通过$ expand使用orderby:
How to use orderby with $expand:
$select=Entity,Id,Points,A_B/name&$orderby=Id asc&$expand=A_B
如何按表B中的排名进行订购?我尝试过:
How can i order by Ranking which is from TABLE B? I've tried:
$select=Entity,Id,Points,A_B/name,A_B/Ranking&$orderby=A_B/Ranking asc&$expand=A_B
不起作用 发生以下错误:
Not working It occurs the following error:
:: Error : 500: Internal Server Error: The expression 'IIF((Convert(value(Microsoft.Crm.Extensibility.OrganizationDataServiceVisitingQueryProvider).GetValue(p, value(System.Data.Services.Providers.ResourceProperty))) == null), null,
这是什么意思?
推荐答案
您可以使用$ expand将表B连接到ODATA查询,但不幸的是,您只能对主实体进行排序.
You can join table B to your ODATA query by using $expand, but unfortunately you can only sort on the primary entity.
您可以对扩展的实体进行过滤,因此可能会颠倒您的逻辑并从B联接中选择A,对B进行排序,然后对A进行过滤.
You can filter on the expanded entity, so you could potentially reverse your logic and select from B join to A, order on B and then filter on A.
http://msdn.microsoft.com/en-us/library/gg309461.aspx
如果发现OData端点受到限制,则始终可以选择使用FetchXML.我使用 https://github.com/paul-way/JCL ,但在Codeplex上还有其他提供更多功能.我写了JCL,所以我很偏心.
If you find the OData endpoint to be limiting, you can always opt to use FetchXML. I use https://github.com/paul-way/JCL but there are others on codeplex that offer more functionality. I wrote JCL, so I'm partial.
这篇关于CRM动态:oData字符串javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!