sap-fiori-add-visual-filter
Add visual filters with charts to SAP Fiori Elements value help dialogs. Use for: displaying aggregated data in filter fields, adding bar/column/line/donut charts to value help, configuring Analytics.AggregatedProperty with sum/average/min/max, setting up @Aggregation.ApplySupported, configuring manifest.json for visual filters, implementing OData V4 aggregation in CAP projects, enhancing List Report filter bars with visual analytics.
What this skill does
# Add Visual Filter Bar to SAP Fiori Elements Application
## Purpose
This skill guides you through adding a visual filter to a value help dialog in SAP Fiori Elements applications. Visual filters display aggregated data as charts (bar, column, line, or donut) to help users filter data visually.
## When to Use This Skill
- Adding visual filters to value help dialogs on filter fields
- Enhancing user experience with graphical data representations
- Displaying aggregated data (sum, average, min, max) in filter selections
- Implementing analytics features in Fiori Elements OData V4 applications
## Prerequisites
- SAP CAP project with OData V4 service
- SAP Fiori Elements application (List Report or Analytical List Page)
- An entity with properties that can be aggregated
- Basic understanding of CDS annotations and manifest.json configuration
## Implementation Steps
### Step 1: Enable Aggregation Support in Service Definition
Add `@Aggregation.ApplySupported` annotation to the entity in your service file (e.g., `srv/service.cds`):
```cds
service YourService {
entity YourEntity as projection on schema.YourEntity;
}
annotate YourService.YourEntity with @Aggregation.ApplySupported: {
Transformations: ['aggregate', 'groupby'],
AggregatableProperties: [
{ Property: MeasureField } // e.g., Amount, Price, Quantity, Revenue
],
GroupableProperties: [
DimensionField1, // e.g., Status, Category, Region, Department
DimensionField2,
// ... other fields that can be grouped
]
};
```
**Key Points:**
- The annotation must be applied directly to the entity, not the service block
- Use `annotate ServiceName.EntityName with @Aggregation.ApplySupported` after the service definition
- `AggregatableProperties`: Numeric fields that can be summed, averaged, etc. (measures)
- `GroupableProperties`: Fields to group by (dimensions)
- Both properties are required for visual filters to work
### Step 2: Define Aggregated Property in Annotations
In your annotations file (e.g., `app/your-app/annotations.cds`), define the aggregated property:
```cds
annotate service.YourEntity @(
Analytics.AggregatedProperty #MeasureField_sum : {
$Type : 'Analytics.AggregatedPropertyType',
Name : 'MeasureField_sum',
AggregatableProperty : MeasureField,
AggregationMethod : 'sum', // Options: sum, min, max, average
@Common.Label : 'Total Amount'
}
);
```
**Aggregation Methods:**
- `sum`: Total sum of values
- `min`: Minimum value
- `max`: Maximum value
- `average`: Average value
### Step 3: Create the Chart Definition
Define a chart that will be displayed in the value help dialog:
```cds
annotate service.YourEntity @(
UI.Chart #visualFilter : {
$Type : 'UI.ChartDefinitionType',
ChartType : #Bar, // Options: #Bar, #Column, #Line, #Donut
Dimensions : [
DimensionField // Field to group by (e.g., Category, Status, Region)
],
DynamicMeasures : [
'@Analytics.AggregatedProperty#MeasureField_sum'
]
}
);
```
**Chart Types:**
- `#Bar`: Horizontal bar chart
- `#Column`: Vertical column chart
- `#Line`: Line chart
- `#Donut`: Donut/pie chart
### Step 4: Create Presentation Variant
Link the chart to a presentation variant:
```cds
annotate service.YourEntity @(
UI.PresentationVariant #visualFilter : {
$Type : 'UI.PresentationVariantType',
Visualizations : [
'@UI.Chart#visualFilter'
]
}
);
```
### Step 5: Configure Value List with Visual Filter
Add the field to SelectionFields and configure the value list:
```cds
annotate service.YourEntity with @(
UI.SelectionFields : [
DimensionField,
// ... other filter fields
]
);
annotate service.YourEntity with {
DimensionField @(
Common.ValueList #visualFilter : {
$Type : 'Common.ValueListType',
CollectionPath : 'YourEntity',
Parameters : [
{
$Type : 'Common.ValueListParameterInOut',
LocalDataProperty : DimensionField,
ValueListProperty : 'DimensionField',
},
],
PresentationVariantQualifier : 'visualFilter',
},
Common.Label : 'Field Label',
)
}
```
**Key Elements:**
- `CollectionPath`: Entity to query for value help data
- `Parameters`: Maps the local property to the value list property
- `PresentationVariantQualifier`: Links to the presentation variant (must match the qualifier from Step 4)
- Field must be included in `UI.SelectionFields` to appear in the filter bar
### Step 6: Configure Visual Filter in Manifest.json
In your Fiori app's `webapp/manifest.json`, configure the visual filter display in the List Report settings:
```json
{
"sap.ui5": {
"routing": {
"targets": {
"YourEntityList": {
"type": "Component",
"id": "YourEntityList",
"name": "sap.fe.templates.ListReport",
"options": {
"settings": {
"contextPath": "/YourEntity",
"controlConfiguration": {
"@com.sap.vocabularies.UI.v1.SelectionFields": {
"filterFields": {
"DimensionField": {
"visualFilter": {
"valueList": "com.sap.vocabularies.Common.v1.ValueList#visualFilter"
}
}
},
"layout": "CompactVisual"
}
}
}
}
}
}
}
}
}
```
**Manifest Configuration Details:**
- `controlConfiguration`: Configure specific UI controls
- `@com.sap.vocabularies.UI.v1.SelectionFields`: Targets the filter bar
- `filterFields`: Object containing field-specific configurations
- `DimensionField`: The field name (must match the field in annotations)
- `visualFilter.valueList`: Full vocabulary path to the value list annotation (including the qualifier)
- `layout`: Set to `"CompactVisual"` to enable visual filter layout in the filter bar
**Important Notes:**
- The `valueList` path must match exactly: `com.sap.vocabularies.Common.v1.ValueList#visualFilter`
- The qualifier after `#` must match the qualifier used in the `@Common.ValueList` annotation
- Without this manifest configuration, the visual filter will not display even if annotations are correct
## Complete Example
Generic implementation template:
**Service Definition (srv/service.cds):**
```cds
service MyService {
entity Products as projection on db.Products;
}
annotate MyService.Products with @Aggregation.ApplySupported: {
Transformations: ['aggregate', 'groupby'],
AggregatableProperties: [
{ Property: Amount } // Your numeric/measure field
],
GroupableProperties: [
Category, // Your dimension field
Status,
CreatedDate
// Add other fields users can group by
]
};
```
**Annotations (app/yourapp/annotations.cds):**
```cds
// Step 2: Define aggregated property
annotate service.Products @(
Analytics.AggregatedProperty #Amount_sum : {
$Type : 'Analytics.AggregatedPropertyType',
Name : 'Amount_sum',
AggregatableProperty : Amount,
AggregationMethod : 'sum',
@Common.Label : 'Total Amount'
}
);
// Step 3: Define chart
annotate service.Products @(
UI.Chart #visualFilter : {
$Type : 'UI.ChartDefinitionType',
ChartType : #Bar,
Dimensions : [
Category
],
DynamicMeasures : [
'@Analytics.AggregatedProperty#Amount_sum'
]
}
);
// Step 4: Create presentation variant
annotate service.Products @(
UI.PresentationVariant #visualFilter : {
$Type : 'UI.PresentationVariantType',
Visualizations : [
'@UI.Chart#visualFilter'
]
}
);
// Step 5a: Add to selection fields
annotate service.Products @(
UI.SelectionFields : [
CategRelated in Data & Analytics
clawarr-suite
IncludedComprehensive management for self-hosted media stacks (Sonarr, Radarr, Lidarr, Readarr, Prowlarr, Bazarr, Overseerr, Plex, Tautulli, SABnzbd, Recyclarr, Unpackerr, Notifiarr, Maintainerr, Kometa, FlareSolverr). Deep library exploration, analytics, dashboard generation, content management, request handling, subtitle management, indexer control, download monitoring, quality profile sync, library cleanup automation, notification routing, collection/overlay management, and media tracker integration (Trakt, Letterboxd, Simkl).
querying-soql
IncludedSOQL query generation, optimization, and analysis with 100-point scoring. Use this skill when the user needs SOQL/SOSL authoring or optimization: natural-language-to-query generation, relationship queries, aggregates, query-plan analysis, and performance or safety improvements for Salesforce queries. TRIGGER when: user writes, optimizes, or debugs SOQL/SOSL queries, touches .soql files, or asks about relationship queries, aggregates, or query performance. DO NOT TRIGGER when: bulk data operations (use handling-sf-data), Apex DML logic (use generating-apex), or report/dashboard queries.
app-store-optimization
IncludedApp Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklists, and tracking ranking changes.
habit-flow
IncludedAI-powered atomic habit tracker with natural language logging, streak tracking, smart reminders, and coaching. Use for creating habits, logging completions naturally ("I meditated today"), viewing progress, and getting personalized coaching.
app-store-optimization
IncludedApp Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklists, and tracking ranking changes.
visualizing-data
IncludedBuilds dashboards, reports, and data-driven interfaces requiring charts, graphs, or visual analytics. Provides systematic framework for selecting appropriate visualizations based on data characteristics and analytical purpose. Includes 24+ visualization types organized by purpose (trends, comparisons, distributions, relationships, flows, hierarchies, geospatial), accessibility patterns (WCAG 2.1 AA compliance), colorblind-safe palettes, and performance optimization strategies. Use when creating visualizations, choosing chart types, displaying data graphically, or designing data interfaces.