Skip to Content
3
Feb 21, 2019 at 11:12 AM

Fiori Elements: Filter based on association property

3896 Views

Hi folks,

im facing a strange Problem in the "ListReport" of the Fiori Elements and hope you can help me to fix my issue. :)

My requirement is to provide some filter-options for the starting Table based on an association. (for example the List shows some SalesOrder Headers and on the Object Page also the SalesOrder Items are provided. And now the User wants just to see the SalesOrder Headers where an Item is included with the Product "XY")

After looking into the CDS-Help i thought that the following Code would work:

define view ZCDS_C_SalesOrder_00 
  as select from ZCDS_I_SalesOrder_00 as SalesOrder 
  association [0..*] to ZCDS_C_SalesOrderItems_00 as _Items on _Items.SalesOrderUUID = SalesOrder.SalesOrderUUID

{
    ....

    @UI.selectionField: [{ element: '_Items.Product', position : 2 }]
    _Items,
}

But unfortunately the Filter for the Product is still not visible in the Filterbar, even under "more Filters".

The CDS-Help (Link to Help) says for UI.selectionField.element the following:

Must be used when an association is annotated, the value is a path to an element of the associated view. You use this option if you want to filter a table for a column that is not defined in your CDS view but in another CDS view.

Example:You define a sales order view in which you want to filter business partners for their country of origin. However, these country information are not maintained in the sales order view but in the business partner view.

So i thought this is exactly what im looking for, but it seems not. :-D

Has anyone an idea how to achieve the requirements with CDS Annotations?

As always any kind of informations is appreciated.

Thanks for your help!

Sascha