-
Notifications
You must be signed in to change notification settings - Fork 350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to $filter on $expand ? #1324
Comments
from c#/odata client point of view this works for me:
although for performance reasons i've restructured all those calls. the odata syntax ref (http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part2-url-conventions.html) says:
my guess to your error might be an edm-model issue not finding your expanded type nested to your root object or perhaps try rebuilding the service reference |
Hi godrage, thanks a lot for your answer :-) I was able to reverse the query, asking to ProductMasterConfigurations collection for record filtering on its key and expanding to the ProductMaster like this: At least i'm able to get something but I'm affraid I will need to expand on more entities from the ProductMaster record, this was the main reason I tried querying the ProductMasters collection at first. Following your advice, this is the error: and I found this in the metadata file:
I'm using the query directly in the browser, so the 'client code' from my application is not used here. If so, is there a way to fix it? I don't really have access to the metadata 'configuration'... Thanks |
Closing this since we are tracking #1162 |
Hi,
I'm trying to filter the expanded records but it does not filter record or returns an error.
This looks like the issue here: #1162
This query does not filter records:
https://server/data/ProductMasters('2012-0000-300')?$expand=ProductMasterConfigurations($filter=ProductConfigurationId eq 'ConfigA')
It produce the same output as this one :
https://elmodemo2beeb4be27bb4432aos.cloudax.dynamics.com/data/ProductMasters('2012-0000-300')?$expand=ProductMasterConfigurations
Using this query,
https://server/data/ProductMasters('2012-0000-300')?$expand=ProductMasterConfigurations&$filter=ProductMasterConfigurations/any(pmc: pmc/ProductConfigurationId eq 'ConfigA')
I'm getting this error:
"Instance property 'ProductMasterConfigurations' is not defined for type 'Dynamics.AX.Application.EcoResProductMasterEntity'"
Stacktrace seems to point to OData code:
"System.Linq.Expressions.Expression.Property(Expression expression, String propertyName) at System.Web.OData.Query.Expressions.FilterBinder.CreatePropertyAccessExpression(Expression source, IEdmProperty property) at System.Web.OData.Query.Expressions.FilterBinder.BindAnyNode(AnyNode anyNode)"
Since I'm not familiar with OData, I did search for information on the internet:
https://stackoverflow.com/questions/9171310/odata-filter-with-items-in-a-expand
And related to the error : https://stackoverflow.com/questions/44679832/instance-property-is-not-defined-for-type-system-int64
I also tried with Linq and got the same error:
context.ProductMasters.Expand("ProductMasterConfigurations").Where(pm => pm.ProductNumber == "2012-0000-300" && pm.ProductMasterConfigurations.Any(pmc => pmc.ProductConfigurationId == "ConfigA"))
So i'm unsure of the synthax or method that I need to use for this, any pointer would be very appreciated.
Thanks a lot!
Francis Harvey
The text was updated successfully, but these errors were encountered: