In addition to the conventional smart filter bar (compact filters) present in other Fiori Elements floorplans, Analytical List Page (ALP) also provides something called visual filters. Which renders your filters in the form of analytical charts (donut, line and bar) to help the end-user with better visualisation of data. In an ALP application, any visual filter will always have a corresponding filter field in the compact filter but a compact filter field can not have any corresponding visual filter. Visual filter and compact filter in an ALP application will always be in sync in terms of value help and selected value.
ALP's Visual filter
ALP's Compact Filter
In this blog, I'll discuss different configurations and annotation for filter area of an ALP application.
Make sure you have been to the previous blog of this blog series and already created a bare bone ALP application.
For reference, you can clone the GIT repo for this sample application which we are building.
To add filters, "UI.SelectionFields" annotation is used
Another way of defining default values for the filter is via the parameters of selectionVariant or selectionPresentatioVariant of the ALP application. You need to to make the manifest property "filterDefaultsFromSelectionVariant" as true in order to use this functionality which by default is false.
Please note that there should be no qualifier for these valueList annotations.
Record Type: Common.ValueListParameterOut determines the
Elements of the main entity set that make it to the filter query
Field from a value help entity set that sets the field value in the main entity set
Record Type: Common.ValueListParameterIn determines the filtering data set from a value help entity set
Record Type: Common.ValueListParameterInOut combination of both in and out parameters. In the above example, both the in and out combination was same hence I have used InOut for simplicity.
Defining visual filters
An ALP must have a visual filter because the visual filter is the most distinguishing factor which differentiates an ALP application from a List Report application. You need an aggregated entity set to define an ALP visual filter i.e. an entity type defined as sap:semantics="aggregate" in the metadata. An aggregated entity type will also have dimensions and measures attributes.
A visual filter of an ALP application is defined via another "Common.ValueList" annotation with a qualifier and PresentationVariantQualifier property which points to the chart annotation. So if you want to have have both value list and visual filter for the same filter property, then you should define two Common.ValueList annotation for the same filter property, one without qualifier for value list and another with qualifier and PresentationVariantQualifier for the visual filter
The above example will create a visual filter for currency field, similarly, you can go ahead and create two more visual filters for product ID and delivery month to make your ALP application filter bar looks like the screenshot I posted at the beginning of this blog.
a little help for the Surprise element in the exercise
Once you create other two visual filters and run your ALP application, you will notice that none of the visual filters is rendering. Because the batch call for all the visual filter is getting timed out as the backend public demo system do not support batch call (I guess).
To overcome this, you can mark your model in the manifest of your application to fire the call individually and do not batch them, by marking the property "useBatch" as false
Please note that this is just a workaround, in a productive scenario all the call must be batched for optimal performance of your application.
In my forthcoming blog where I explain ALP application developer extensions, I'll also discuss how can we group ALP visual filter batch calls for optimal performance.
A word of caution !!
We should never create more than one visual filter for one dimension. Like for in our example we have defined only one visual filter for each dimension i.e. currency, product and delivery. This is because let's say you have defined two visual filters like revenue by currency and quantity by currency and in first visual filter end-user have selected USD and in second visual filter, end-user have selected EUR then the final query will be like currency eq 'USD' & currency eq 'EUR', which will never yield any results.
In this blog, we successfully configured the filter area of our ALP application and learnt about different settings for the filter area.
In the next blog, I’ll about how to configure ALP's chart area.