-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MultiLevelExpand transformation #293
base: main
Are you sure you want to change the base?
Changes from 41 commits
4750db8
53368e3
64e5ae7
b5a6f34
9238702
34b5a64
443f99c
2fb8ff2
f5dea9f
41b289a
2df14e4
defafdf
8584dfe
f27abe8
3ca799d
92f1abd
bb78f7d
4181573
b227e7f
e390b0c
b9ecf4f
b587137
ae774a6
3cb5082
c9bbadf
3e6379a
f98c999
64f96eb
bc35559
9f24039
8c7b80b
4dfd1c6
5036eba
192cc17
fbe94b9
f603089
66e2af7
4cd0ad4
f7059d6
e51acaa
ff2ea96
8b99b2c
00badf5
0ae8299
20ee029
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,9 @@ | |
}, | ||
"https://sap.github.io/odata-vocabularies/vocabularies/Common.json": { | ||
"$Include": [{ "$Namespace": "com.sap.vocabularies.Common.v1", "$Alias": "Common" }] | ||
}, | ||
"https://sap.github.io/odata-vocabularies/vocabularies/Hierarchy.json": { | ||
"$Include": [{ "$Namespace": "com.sap.vocabularies.Hierarchy.v1", "$Alias": "Hierarchy" }] | ||
} | ||
}, | ||
"com.sap.vocabularies.Analytics.v1": { | ||
|
@@ -161,6 +164,115 @@ | |
"@[email protected]": "Adding a list of other terms that can be annotated to it.", | ||
"@Validation.ApplicableTerms": ["Common.Label"] | ||
} | ||
}, | ||
"MultiLevelExpand": [ | ||
{ | ||
"$Kind": "Function", | ||
"$EntitySetPath": "InputSet", | ||
"$IsBound": true, | ||
"@Common.Experimental": true, | ||
"@Core.Description": "`$apply` transformation that expands an unnamed leveled hierarchy with custom aggregation of certain properties", | ||
"@Core.LongDescription": "Example transformation sequence:\nfilter on columns `Industry`, `Amount` and `Currency`,\norder by `Amount` descending,\nshow 2 levels, with two exceptions\n```\n$apply=filter(Industry in ('IT','AI'))\n/groupby((Country,Region,Segment,Industry),\n filter($these/aggregate(Amount) gt 0 and\n $these/aggregate(Currency) ne null))\n/concat(\n groupby((Country,Region,Segment,Industry))\n /aggregate($count as LeavesCount),\n aggregate(Amount,Currency),\n Analytics.MultiLevelExpand(\n Levels=[{\"DimensionProperties\":[\"Country\"],\"AdditionalProperties\":[\"CountryName\"]},\n {\"DimensionProperties\":[\"Region\"],\"AdditionalProperties\":[\"RegionName\"]},\n {\"DimensionProperties\":[\"Segment\",\"Industry\"],\"AdditionalProperties\":[]}],\n Aggregation=[\"Amount\",\"Currency\"],\n SiblingOrder=[{\"Property\":\"Amount\",\"Descending\":true}],\n ShowLevels=2,\n ExpandEntries=[{\"Entry\":[\"US\"],\"Levels\":0},\n {\"Entry\":[\"DE\",\"BW\"],\"Levels\":1}]\n )/concat(aggregate($count as ResultEntriesCount),\n skip(20)/top(10)))\n```\n", | ||
"$Parameter": [ | ||
{ | ||
"$Name": "InputSet", | ||
"$Collection": true, | ||
"$Type": "Edm.EntityType", | ||
"@Core.Description": "Entity set to be processed" | ||
}, | ||
{ | ||
"$Name": "Levels", | ||
"$Collection": true, | ||
"$Type": "Analytics.MultiLevelExpandLevel", | ||
"@Core.Description": "Collection of aggregation levels forming a leveled hierarchy", | ||
"@Core.LongDescription": "Each element in the collection defines the properties that constitute one level.\n A property must not be referenced by more than one level.\n The first element in the collection defines the property names of the coarsest level,\n the following elements define the property names of consecutively finer-grained aggregation levels.\n The function result is the leveled hierarchy with these levels in preorder,\n entries on the finest-grained level cannot be expanded further.\n All referenced properties must be groupable." | ||
}, | ||
{ | ||
"$Name": "Aggregation", | ||
HeikoTheissen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"$Collection": true, | ||
"@Core.Description": "Properties to aggregate for all result entries on all levels", | ||
"@Core.LongDescription": "All properties in this collection must be custom aggregates." | ||
}, | ||
{ | ||
"$Name": "SiblingOrder", | ||
"$Collection": true, | ||
"$Type": "Analytics.MultiLevelExpandSiblingOrder", | ||
"@Core.Description": "Sort specification to apply to all direct descendants of a given entry in the resulting leveled hierarchy" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Sibling" vs "all direct descendants of a given entry" maybe we could harmonize the wording |
||
}, | ||
{ | ||
"$Name": "ShowLevels", | ||
"$Type": "Edm.Int64", | ||
"@Core.Description": "Number N of levels to be shown in the initial expansion", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we start counting with 0 or with 1? 1, I assume. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is nothing to be shown at level 0. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But is this clear enough from the description(s)? |
||
"@Core.LongDescription": "The initial expansion shows the first N levels as defined in `Levels` (0 ≤ N ≤ length of `Levels`).\n If this parameter is omitted, all levels are shown.", | ||
"@Core.OptionalParameter": {} | ||
}, | ||
{ | ||
"$Name": "ExpandEntries", | ||
"$Collection": true, | ||
"$Type": "Analytics.MultiLevelExpandEntry", | ||
"@Core.Description": "Entries with exceptional expansion", | ||
"@Core.OptionalParameter": {} | ||
}, | ||
{ | ||
"$Name": "SubtotalsAtBottom", | ||
"$Type": "Edm.Bool", | ||
"@Core.Description": "Whether to duplicate the group headers so that they appear before and after their descendants", | ||
Comment on lines
+217
to
+219
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "AtBottom" vs "before and after" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The name reflects what you see in the UI. The description makes clear that the row appears duplicated in the result set. |
||
"@Core.LongDescription": "The entry before has [DrillState](Hierarchy.md#HierarchyType) `expanded`,\n the entry after has DrillState `subtotal`.", | ||
"@Core.OptionalParameter": { "DefaultValue": "false" } | ||
} | ||
], | ||
"$ReturnType": { | ||
"$Collection": true, | ||
"$Type": "Edm.EntityType", | ||
"@Core.Description": "Output set including the instance annotation [`LevelInformation`](#LevelInformation)" | ||
} | ||
} | ||
], | ||
"MultiLevelExpandLevel": { | ||
"$Kind": "ComplexType", | ||
"@Common.Experimental": true, | ||
"@Core.Description": "Property names constituting a level in an [unnamed leveled hierarchy](#MultiLevelExpand)", | ||
"@Core.LongDescription": "`DimensionProperties` must be used to identify entries in [`ExpandEntries/Entry`](#MultiLevelExpandEntry),\n otherwise they have the same effect as `AdditionalProperties`.", | ||
"DimensionProperties": { | ||
"$Collection": true, | ||
"@Core.Description": "A non-empty list of property names that define a combination of dimension values" | ||
}, | ||
"AdditionalProperties": { | ||
"$Collection": true, | ||
"@Core.Description": "A possibly empty list of names of additional properties of the dimensions that occur in `DimensionProperties`" | ||
} | ||
}, | ||
"MultiLevelExpandSiblingOrder": { | ||
"$Kind": "ComplexType", | ||
"@Common.Experimental": true, | ||
"@Core.Description": "Sibling order in an [unnamed leveled hierarchy](#MultiLevelExpand)", | ||
"Property": { "@Core.Description": "Property by which to sort" }, | ||
"Descending": { | ||
"$Type": "Edm.Boolean", | ||
"$Nullable": true, | ||
"@Core.Description": "Sort direction, ascending if not specified otherwise" | ||
} | ||
}, | ||
"MultiLevelExpandEntry": { | ||
"$Kind": "ComplexType", | ||
"@Common.Experimental": true, | ||
"@Core.Description": "Expansion state of an entry in an [unnamed leveled hierarchy](#MultiLevelExpand)", | ||
"Entry": { | ||
"$Collection": true, | ||
"@Core.Description": "An entry on a given [level](#MultiLevelExpandLevel) is identified by a list of values for the `DimensionProperties` that constitute all levels up to and including the given one" | ||
}, | ||
"Levels": { | ||
"$Type": "Edm.Int64", | ||
"$Nullable": true, | ||
"@Core.Description": "Number of levels to be expanded, null means all levels, 0 means collapsed" | ||
} | ||
}, | ||
"LevelInformation": { | ||
"$Kind": "Term", | ||
"$Type": "Hierarchy.HierarchyType", | ||
"$AppliesTo": ["EntityType"], | ||
"@Common.Experimental": true, | ||
"@Core.Description": "Information about grouping levels in the result set of a request including the [`MultiLevelExpand`](#MultiLevelExpand) transformation" | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we use the term "dimension" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, because
CountryName
is groupable and can appear here, but is not a dimension. It is a dimension text, there are also dimension attributes.