简体   繁体   English

CRM动态:oData字符串javascript

[英]CRM dynamics: oData string javascript

Imagine two tables: 想象两个表:

TABLE A           |TABLE B
Entity            |Id
Id                |name
Points            |Ranking           

How to use orderby with $expand: 如何通过$ expand使用orderby:

$select=Entity,Id,Points,A_B/name&$orderby=Id asc&$expand=A_B

How can i order by Ranking which is from TABLE B? 如何按表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,  

What this means? 这是什么意思

I believe that you would not be able to sort by field of expanded entity. 我相信您将无法按扩展实体的字段进行排序。 You should look for other workaround to make that possible. 您应该寻找其他解决方法以实现这一目标。

You can join table B to your ODATA query by using $expand, but unfortunately you can only sort on the primary entity. 您可以使用$ expand将表B连接到ODATA查询,但是不幸的是,您只能对主实体进行排序。

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. 您可以对展开的实体进行过滤,因此可能会颠倒逻辑并从B联接选择为A,对B进行排序,然后对A进行过滤。

http://blogs.msdn.com/b/crm/archive/2011/03/02/using-odata-retrieve-in-microsoft-dynamics-crm-2011.aspx?Redirected=true http://blogs.msdn.com/b/crm/archive/2011/03/02/using-odata-retrieve-in-microsoft-dynamics-crm-2011.aspx?Redirected=true

http://msdn.microsoft.com/en-us/library/gg309461.aspx http://msdn.microsoft.com/en-us/library/gg309461.aspx

If you find the OData endpoint to be limiting, you can always opt to use FetchXML. 如果您发现OData端点受到限制,则始终可以选择使用FetchXML。 I use https://github.com/paul-way/JCL but there are others on codeplex that offer more functionality. 我使用https://github.com/paul-way/JCL,但Codeplex上还有其他提供更多功能的工具。 I wrote JCL, so I'm partial. 我写了JCL,所以我很偏心。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM