UI5 / UI5/openui5

ODataListBinding: Filter cannot be applied to aggregated property

Open
#3,997 5 comments 0 reactions 2 assignees View on GitHub

Nobody has claimed this yet.

documentation enhancement in progress
Dominant language
JavaScript
Stars
3.3k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

OpenUI5 version: 1.121.0

Browser: Google Chrome

URL (minimal example if possible): https://github.com/tofriede/odata-v4-filter-aggregation

Steps to reproduce the problem:

  1. Create a sap.ui.model.odata.v4.ODataListBinding
  2. Aggregate a numeric property
  3. Apply a sap.ui.model.Filter based on the aggregated property

What is the expected result?

The list binding should execute an OData request with the query option $apply, in which the data is aggregated first and then the corresponding filter is applied. The fact that this should be possible is also mentioned in the documentation under Extension for Data Aggregation (section: Filtering).

What happens instead?

Before the request is fired, the ListBinding analyzes the applied filter and tries to determine the type of the aggregated property via the MetaModel. However, this fails because an alias must be used for the aggregation that is not known to the MetaModel, as this is defined on the client side.

image

https://github.com/SAP/openui5/blob/2baad67a9dfdb39be38b027396d3646c57162d70/src/sap.ui.core/src/sap/ui/model/odata/v4/ODataListBinding.js#L1798

Since the mapping of aliases and original property names is known to the ListBinding (getAggregation), it should also be able to identify the types of aggregated properties.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.