1

Is there a possibility to apply a Filter on another Filter in SAPUI5?

I have a HTML5 web application that basically displays year and products that were sold. The data comes from SAP HANA through an OData connection. I have a Tree Selection to display different categories of those products.

Basically in the database I have things like:

2014 | A | 4

2014 | B | 6

A and B being the categories. When initialising my views ( I have lists and VizFrames to visualize data) I use a parameters : {select : 'YEAR, SUMofITEMS'} in the 'data'-part when defining the model. So I get an aggregation and that works fine. On single selection mode of the Tree Selection it works also fine.

The problem is MultiSelect in that Tree :( The filter I apply to my modell basically does this:

(YEAR = 2014) AND (CATEGORY = A OR CATEGORY = B)

My results should be, by my logic, 10 (if you consider the example I gave above). But the Filter thinks otherwise - it picks the exact matches between Category and Year, so I get two results/Objects instead of one. I get that logic, but I don't want it for the MultiSelect Mode.

Is there a way to say you apply first a filter on the category (so it's A OR B), basically already minimizing the model and then apply a year filter to that filtered object in one single request?

I tried applying the filters one after another but that doesn't seem to work. Maybe I am just lacking the logical thinking right now. I hope you guys can help me

Thank you :)

My scanner quit its job, so I had to take a picture

Notche
  • 11
  • 4
  • Would this help you? https://stackoverflow.com/q/42433200/5846045 – Boghyon Hoffmann Jun 20 '17 at 07:41
  • Thank you for the link :) I did try implementing the filters like that. The problem being I get a result-set of the matching items, which is correct, but I can't seem to be able to aggregate those objects anymore, so that I get the total sum of those articles of different categories. I basically need some kind of query that says : 'hey those results you got as a set please kindly group them by year no matter how many objects you retrieved'. I will scatch the scenario and try to upload a picture :) – Notche Jun 20 '17 at 10:36
  • 1
    Which version of ODataModel are you using? If V2 is used, the aggregation part has to be done either separately on the client or on backend by using a custom query. V4 on the other hand supports aggregation of filtered values in a single request according to the [spec](https://www.oasis-open.org/committees/document.php?document_id=50359&wg_abbrev=odata). – Boghyon Hoffmann Jun 20 '17 at 15:06

0 Answers0