Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

OData $filter on expanded association

Hello,

I have a question regarding how to filter an odata principal object based on criteria in associated objects.  For example, my service exposes Customers and Orders, where there's a 1-n association.  Here's the service definition:

service {  
      "com.example::Customers" as "Customer" keys ("ID")
            navigates ("Customer_Orders" as "Orders" from principal);
      
      "com.example::Orders" as "Order" keys ("ORDER_ID");

      association "Customer_Orders" principal "Customer"("ID") multiplicity "1" dependent "Orders"("CUSTOMER_ID") multiplicity "*";
}

What I want to do is find any customers that have any orders with Type equal to "airmail". According to this stackoverflow answer, my request path should look like the following:

/Example.xsodata/Customer?$format=json&$expand=Orders&$filter=Orders/any(o: o/Type eq 'airmail')

This doesn't work. I'm wondering whether HANA supports this functionality, or if it is an error on my part?  I understand that HANA supports a limited subset of odata filter functionality.

Thanks!

Tags:
Former Member
replied

Hello Charles,

at the moment HANA supports OData v2.0. In your example you used a so called "lambda operator". These operators are introduced with OData v3.0.

So at the moment it will not work on HANA.

Best Regards,

Florian

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question