namespace my.bookshop;
entity Books {
key ID : Integer @title: 'ID';
title : String @title: 'Title';
stock : Integer @title: 'Stock';
category1: String @title: 'Category1';
category2: String @title: 'Category2';
publishedAt: Date @title: 'Published At';
}
using my.bookshop as my from '../db/data-model';
service CatalogService {
@readonly entity BooksAnalytics as projection on my.Books;
}
annotate CatalogService.BooksAnalytics with @(
Aggregation.ApplySupported: {
Transformations: [
'aggregate',
'topcount',
'bottomcount',
'identity',
'concat',
'groupby',
'filter',
'expand',
'search'
],
GroupableProperties: [
ID,
category1,
category2,
title,
publishedAt
],
AggregatableProperties: [{
$Type : 'Aggregation.AggregatablePropertyType',
Property: stock
}]
},
Analytics.AggregatedProperty #totalStock: {
$Type : 'Analytics.AggregatedPropertyType',
AggregatableProperty : stock,
AggregationMethod : 'sum',
Name : 'totalStock',
![@Common.Label]: 'Total stock'
},
);
annotate CatalogService.BooksAnalytics with @(
UI.Chart: {
$Type : 'UI.ChartDefinitionType',
Title: 'Stock',
ChartType : #Column,
Dimensions: [
category1,
category2
],
DimensionAttributes: [{
$Type : 'UI.ChartDimensionAttributeType',
Dimension: category1,
Role: #Category
},{
$Type : 'UI.ChartDimensionAttributeType',
Dimension: category2,
Role: #Category2
}],
DynamicMeasures: [
![@Analytics.AggregatedProperty#totalStock]
],
MeasureAttributes: [{
$Type: 'UI.ChartMeasureAttributeType',
DynamicMeasure: ![@Analytics.AggregatedProperty#totalStock],
Role: #Axis1
}]
},
UI.PresentationVariant: {
$Type : 'UI.PresentationVariantType',
Visualizations : [
'@UI.Chart',
],
}
);
annotate CatalogService.BooksAnalytics with @(
UI.Chart #category1: {
$Type : 'UI.ChartDefinitionType',
ChartType: #Bar,
Dimensions: [
category1
],
DynamicMeasures: [
![@Analytics.AggregatedProperty#totalStock]
]
},
UI.PresentationVariant #prevCategory1: {
$Type : 'UI.PresentationVariantType',
Visualizations : [
'@UI.Chart#category1',
],
}
){
category1 @Common.ValueList #vlCategory1: {
$Type : 'Common.ValueListType',
CollectionPath : 'BooksAnalytics',
Parameters: [{
$Type : 'Common.ValueListParameterInOut',
ValueListProperty : 'category1',
LocalDataProperty: category1
}],
PresentationVariantQualifier: 'prevCategory1'
}
}
annotate CatalogService.BooksAnalytics with@(
UI: {
SelectionFields : [
category1,
category2,
publishedAt
],
LineItem: [
{ $Type : 'UI.DataField', Value : ID, },
{ $Type : 'UI.DataField', Value : title, },
{ $Type : 'UI.DataField', Value : category1, },
{ $Type : 'UI.DataField', Value : category2, },
{ $Type : 'UI.DataField', Value : stock, },
{ $Type : 'UI.DataField', Value : publishedAt, },
],
}
);
"options": {
"settings": {
"entitySet": "BooksAnalytics",
...,
"controlConfiguration": {
"@com.sap.vocabularies.UI.v1.LineItem": {
"tableSettings": {
"type": "ResponsiveTable",
"selectionMode": "None"
}
},
"@com.sap.vocabularies.UI.v1.SelectionFields": {
"layout": "CompactVisual",
"initialLayout": "Visual",
"filterFields": {
"category1": {
"visualFilter": {
"valueList": "com.sap.vocabularies.Common.v1.ValueList#vlCategory1"
}
},
"category2": {
"visualFilter": {
"valueList": "com.sap.vocabularies.Common.v1.ValueList#vlCategory2"
}
},
"publishedAt": {
"visualFilter": {
"valueList": "com.sap.vocabularies.Common.v1.ValueList#vlPublishedAt"
}
}
}
}
},
"views": {
"paths": [
{
"primary": [{"annotationPath": "com.sap.vocabularies.UI.v1.PresentationVariant"}],
"secondary": [{"annotationPath": "com.sap.vocabularies.UI.v1.LineItem"}],
"defaultPath": "both"
}
]
}
}
}
annotate CatalogService.BooksAnalytics with @(
Aggregation.ApplySupported
);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
53 | |
5 | |
4 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |