Filter OpportunityFileCollection by Opportunity using ODATA

Hi,

I'm trying to get a list of OpportunityFile associated with an OpportunityId and it's seems it's not possible using ODATA.

1. If I'm using this Url https://server.bpmonline.com/0/ServiceModel/EntityDataService.svc/Oppor… I'm getting a "Not Implemented" exception

<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<script/>
<code>4</code>
<message xml:lang="">Not Implemented</message>
<innererror>
<message>Not Implemented</message>
<type>System.Data.Services.DataServiceException</type>
<stacktrace>
at System.Data.Services.WebUtil.GetRequestEnumerator(IEnumerable enumerable)
 at System.Data.Services.DataService`1.SerializeResponseBody(RequestDescription description, IDataService dataService, IODataResponseMessage responseMessage)
 at System.Data.Services.DataService`1.HandleRequest()
</stacktrace>
<internalexception>
<message>Method 'SelectMany' not supported</message>
<type>System.NotSupportedException</type>
<stacktrace>
at Terrasoft.Core.Entities.EntityQueryProvider.VisitMethodCall(MethodCallExpression node)
 at Terrasoft.Core.Entities.EntityQueryProvider.Build(Expression expression)
 at Terrasoft.Core.Entities.EntityQueryProvider.LoadEntityCollection(Expression expression)
 at Terrasoft.Core.Entities.EntityQueryProvider.ExecuteEnumerable(Type elementType, Expression expression)
 at Terrasoft.Core.Entities.EntityQuery`1.GetEnumerator()
 at System.Data.Services.WebUtil.GetRequestEnumerator(IEnumerable enumerable)
</stacktrace>
</internalexception>
</innererror>
</error>

2. If I'm using this Url https://server.bpmonline.com/0/ServiceModel/EntityDataService.svc/Oppor… eq guid'e14b9eb7-99ff-43a6-bf26-a60b23b3ec12') I'm getting the following exception:

<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<script/>
<code>1</code>
<message xml:lang="">Collection item with name OpportunityId not found.</message>
<innererror>
<message>Collection item with name OpportunityId not found.</message>
<type>Terrasoft.Common.ItemNotFoundException</type>
<stacktrace>
at Terrasoft.Core.Entities.EntitySchema.GetSchemaColumnByPath(String columnPath)
 at Terrasoft.Core.Entities.EntityQueryWhereBlockBuilder.CreateExpression(Expression node)
 at Terrasoft.Core.Entities.EntityQueryWhereBlockBuilder.CreateSimpleFilter(BinaryExpression binary)
 at Terrasoft.Core.Entities.EntityQueryWhereBlockBuilder.CreateFilter(Expression node)
 at Terrasoft.Core.Entities.EntityQueryWhereBlockBuilder.BuildBlock(MethodCallExpression node)
 at Terrasoft.Core.Entities.EntityQueryProvider.VisitMethodCall(MethodCallExpression node)
 at Terrasoft.Core.Entities.EntityQueryProvider.Build(Expression expression)
 at Terrasoft.Core.Entities.EntityQueryProvider.LoadEntityCollection(Expression expression)
 at Terrasoft.Core.Entities.EntityQueryProvider.ExecuteEnumerable(Type elementType, Expression expression)
 at Terrasoft.Core.Entities.EntityQuery`1.GetEnumerator()
 at System.Data.Services.WebUtil.GetRequestEnumerator(IEnumerable enumerable)
 at System.Data.Services.DataService`1.SerializeResponseBody(RequestDescription description, IDataService dataService, IODataResponseMessage responseMessage)
 at System.Data.Services.DataService`1.HandleRequest()
</stacktrace>
</innererror>
</error>

3. Also, if I'm using this Url https://server.bpmonline.com/0/ServiceModel/EntityDataService.svc/Oppor… eq guid'b3427cc4-3b20-4c16-8d2a-058ada7e7631') I'm getting a different error.

<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<script/>
<code>4</code>
<message xml:lang="">Syntax error at position 1.</message>
<innererror>
<message>Syntax error at position 1.</message>
<type>System.Data.Services.DataServiceException</type>
<stacktrace>
at System.Data.Services.Parsing.ExpressionLexer.ValidateToken(TokenId t)
 at System.Data.Services.Parsing.ExpressionLexer.ReadDottedIdentifier(Boolean allowEndWithDotStar)
 at System.Data.Services.RequestQueryProcessor.ReadExpandOrSelect(String value, Boolean select, IDataService dataService)
 at System.Data.Services.RequestQueryProcessor.ProcessSelect()
 at System.Data.Services.RequestQueryProcessor.ProcessQuery()
 at System.Data.Services.RequestQueryProcessor.ProcessQuery(IDataService service, RequestDescription description)
 at System.Data.Services.RequestUriProcessor.ProcessRequestUri(Uri absoluteRequestUri, IDataService service, Boolean internalQuery)
 at System.Data.Services.DataService`1.HandleRequest()
</stacktrace>
</innererror>
</error>

It seems the filtering is not working on associated collection entities. Do you have any ideas?

Regards,

Radu

Like 0

Like

1 comments

Dear Radu,

Please see the example below. Draw your attention to the column OpportunityId syntax - Opportunity/Id

 

http://localhost:8006/0/ServiceModel/EntityDataService.svc/OpportunityF… = Opportunity/Id eq guid'410006e1-ca4e-4502-a9ec-e54d922d2c00'

 

Regards, 

Anastasia

Show all comments