CDS - Filter List Reports by Child Entity Fields
👋 Hello Everyone!
Filter List Reports by Child Entity Fields
Have you ever wanted to filter a list report based on a field from a child entity? For example, filtering travel records by the AirlineID from the associated _Booking entity?
You can achieve this by adding the following annotation to the root CDS view metadata extension (e.g., Travel):
@UI.selectionField: [{ element: '_Booking.AirlineID', position: 50 }]
_Booking;
🎥 Demo: Filtering by Child Entity Field (OData V4)
I tested this in the BTP ABAP Environment, and it works perfectly — but only with OData V4.
My problem is that I need two fields from the same child entity, but you can’t reference the entity twice. How would you handle that?
ReplyDeleteHi, You can define your fields like this.
Delete@UI.selectionField: [{ element: '_entity.field1', position: 10 },
{ element: '_entity.field2', position: 20 }]
_entity;