Issue with Filtering in AspNetCoreOData After Expanding the Object #1260
Unanswered
anjanasagathiya
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Subject: Issue with Filtering in AspNetCoreOData After Expanding the Object
Problem Description:
We are currently using AspNetCoreOData version 7.20.0 and have encountered an issue with filtering after expanding objects. The problem manifests as a discrepancy in the data returned for specific OData queries, leading to incorrect results.
OData Query 1:
{{Base_URL}}/finance/odata/v2/payments/PaymentOperation.v2.GetByVendorType?vendor_type='publisher'&$filter=id eq 28965 and vendor/id eq 128493&$count=true&orderby=paid_at desc&$expand=bills($expand=offer;$count=true)
OData Query 2:
{{Base_URL}}/finance/odata/v2/payments/PaymentOperation.v2.GetByVendorType?vendor_type='publisher'&$filter=id eq 28965 and vendor/id eq 128493&$count=true&orderby=paid_at desc&$expand=bills($expand=offer;$count=true;$filter=offer/campaign_name eq 'Default')
Issue:
In the first query, we apply the filter id eq 28965 and vendor/id eq 128493, which correctly returns four records in the bills object with a total sum of 700 of paid_amount in amount field.
However, in the second query, when we add a filter to the expanded offer object ($expand=bills($expand=offer;$count=true;$filter=offer/campaign_name eq 'Default')), it returns only two records in the bills object. Despite this, the amount field at the root level incorrectly remains 700 instead of 300, reflecting the sum of the filtered records.
Request for Assistance:
We seek guidance on how to correctly calculate and display the amount field in the API response when using AspNetCoreOData v7.20.0, given the current constraints. Specifically, we need:
We appreciate any insights or solutions that can help resolve this issue efficiently.
Beta Was this translation helpful? Give feedback.
All reactions