You can associate every button of the segmented buttons (or every list item in the select box) with a selection variant that filters the table according to the selection variant filters once a user has clicked it. This means that the user has multiple views in a single table of the object page. You can enable this feature for any table on the object page.
To implement this feature, make a "quickVariantSelection"
entry in the manifest. See the separate sections below for further
details.
You can define a simple or a complex filter condition inside the
SelectionVariant
. While the simple condition has only one property in the
SelectionVariant
, the complex filter condition can have more than one
property to be filtered.
The annotations defined in the variants are:
XML Annotation
<Annotation Term="UI.SelectionVariant" Qualifier="SimpleFilter"> <Record> <PropertyValue Property="Text" String="Tax amount less than 10 USD" /> <PropertyValue Property="SelectOptions"> <Collection> <Record Type="UI.SelectOptionType"> <PropertyValue Property="PropertyName" PropertyPath="tax_amount" /> <PropertyValue Property="Ranges"> <Collection> <Record Type="UI.SelectionRangeType"> <PropertyValue Property="Sign" EnumMember="UI.SelectionRangeSignType/I" /> <PropertyValue Property="Option" EnumMember="UI.SelectionRangeOptionType/LT" /> <PropertyValue Property="Low" String="10" /> </Record> </Collection> </PropertyValue> </Record> </Collection> </PropertyValue> </Record> </Annotation> <Annotation Term="UI.SelectionVariant" Qualifier="ComplexFilter"> <Record> <PropertyValue Property="Text" String="Net Amount between 10 and 40 And Gross Amount Less than 100 USD" /> <PropertyValue Property="SelectOptions"> <Collection> <Record Type="UI.SelectOptionType"> <PropertyValue Property="PropertyName" PropertyPath="net_amount" /> <PropertyValue Property="Ranges"> <Collection> <Record> <PropertyValue Property="Sign" EnumMember="com.sap.vocabularies.UI.v1.SelectionRangeSignType/I" /> <PropertyValue Property="Option" EnumMember="UI.SelectionRangeOptionType/BT" /> <PropertyValue Property="Low" String="10" /> <PropertyValue Property="High" String="40" /> </Record> </Collection> </PropertyValue> </Record> <Record Type="UI.SelectOptionType"> <PropertyValue Property="PropertyName" PropertyPath="gross_amount" /> <PropertyValue Property="Ranges"> <Collection> <Record Type="UI.SelectionRangeType"> <PropertyValue Property="Option" EnumMember="UI.SelectionRangeOptionType/LT" /> <PropertyValue Property="Sign" EnumMember="UI.SelectionRangeSignType/I" /> <PropertyValue Property="Low" String="100" /> </Record> </Collection> </PropertyValue> </Record> </Collection> </PropertyValue> </Record> </Annotation>
ABAP CDS Annotation
@UI.selectionVariant: [ { text: 'Tax amount less than 10 USD', qualifier: 'SimpleFilter', filter: 'tax_amount LT 10' } ] @UI.selectionVariant: [ { text: 'Net Amount between 10 and 40 And Gross Amount Less than 100 USD', qualifier: 'ComplexFilter', filter: 'net_amount GE 10 and net_amount LE 40 and gross_amount LT 100 ' } ]
CAP CDS Annotation
UI.SelectionVariant #SimpleFilter : { Text : 'Tax amount less than 10 USD', SelectOptions : [ { $Type : 'UI.SelectOptionType', PropertyName : tax_amount, Ranges : [ { $Type : 'UI.SelectionRangeType', Sign : #I, Option : #LT, Low : '10' } ] } ] }, UI.SelectionVariant #ComplexFilter : { Text : 'Net Amount between 10 and 40 And Gross Amount Less than 100 USD', SelectOptions : [ { $Type : 'UI.SelectOptionType', PropertyName : net_amount, Ranges : [ { Sign : #I, Option : #BT, Low : '10', High : '40' } ] }, { $Type : 'UI.SelectOptionType', PropertyName : gross_amount, Ranges : [ { $Type : 'UI.SelectionRangeType', Option : #LT, Sign : #I, Low : '100' } ] } ] }
If the SelectionVariant
has multiple
<SelectionOptionType>
, filters that have the same target property
are combined with an
OR
condition. Filters that have different target properties are combined with an
AND
condition.
The table containing the segmented buttons looks like this:
When the table is initially loaded, two calls are made to determine the number of records in the table. These are shown in the button text.
In SAP Fiori elements for OData
V2, setting
showCounts
to false
will not show the number in the
button text. This means that in this case no count calls are made.
In SAP Fiori elements for OData
V4,
showCounts
is set to false
by default.