Daanse Tutorial — Writeback with two dimensions, one of them multi-level.
Extends the single-dimension tutorial.writeback.decimal example with a second dimension (Region) that has two levels (Country → City). The point: writeback works the same way regardless of the slicer's depth — the runtime always writes the leaf-key value of every connected dimension into the writeback table, no matter which level the user typed at in the UI.
The cube exposes:
Amount — SumMeasure over a DECIMAL(18,2) column.
Comments — TextAggMeasure over a VARCHAR column.
Two DimensionConnectors (Product, Region) both feed WritebackAttributes pointing at the matching writeback columns. The Region connector's foreign key is the leaf-level CITY column on the fact — exactly the column the writeback row will carry.
FACT — PRODUCT (VARCHAR), CITY (VARCHAR), AMOUNT (DECIMAL), COMMENT (VARCHAR).
PRODUCT — KEY (VARCHAR), NAME (VARCHAR).
REGION — COUNTRY_KEY (VARCHAR), COUNTRY_NAME (VARCHAR), CITY_KEY (VARCHAR), CITY_NAME (VARCHAR). Single denormalised table that lists every city with its owning country.
FACTWB — PRODUCT (VARCHAR), CITY (VARCHAR), AMOUNT (DECIMAL), COMMENT (VARCHAR), ID (VARCHAR, UUID written by the engine), USER (VARCHAR, session user).
Two-dimensional cell coordinates. Every cell in this cube has a (Product, City) coordinate. A Cell.setValue([Measures].[Amount], 99.95, ...) issued at an intermediate Country member is allocated across the country's cities (each city gets 99.95 / N); a write at a specific city goes directly to that one leaf.
Text writeback semantics. The Comments measure follows the text short-path: a single row at the cell's exact (Product, City-or-Country) coordinate; intermediate-level writes record the country's COUNTRY_KEY as the city attribute (since Region's writeback attribute targets the CITY column). At read time the ListAggAggregator re-aggregates everything through SQL.
Both writeable measures share the same writeback table. Numeric and text writes interleave freely; each call produces its own row(s) tagged with a fresh UUID ID and the session USER.
One physical cube C over FACT with two DimensionConnectors (Product, Region), one MeasureGroup holding the decimal Amount plus the text Comments measure, and the FACTWB writeback table.
Daanse Tutorial - Writeback Multi-Dimension
Daanse Tutorial — Writeback with two dimensions, one of them multi-level.
Extends the single-dimension
tutorial.writeback.decimalexample with a second dimension (Region) that has two levels (Country → City). The point: writeback works the same way regardless of the slicer's depth — the runtime always writes the leaf-key value of every connected dimension into the writeback table, no matter which level the user typed at in the UI.The cube exposes:
Amount—SumMeasureover aDECIMAL(18,2)column.Comments—TextAggMeasureover aVARCHARcolumn.Two
DimensionConnectors (Product, Region) both feedWritebackAttributes pointing at the matching writeback columns. TheRegionconnector's foreign key is the leaf-levelCITYcolumn on the fact — exactly the column the writeback row will carry.Database Schema
Four tables:
FACT—PRODUCT(VARCHAR),CITY(VARCHAR),AMOUNT(DECIMAL),COMMENT(VARCHAR).PRODUCT—KEY(VARCHAR),NAME(VARCHAR).REGION—COUNTRY_KEY(VARCHAR),COUNTRY_NAME(VARCHAR),CITY_KEY(VARCHAR),CITY_NAME(VARCHAR). Single denormalised table that lists every city with its owning country.FACTWB—PRODUCT(VARCHAR),CITY(VARCHAR),AMOUNT(DECIMAL),COMMENT(VARCHAR),ID(VARCHAR, UUID written by the engine),USER(VARCHAR, session user).Note: This is only a symbolic example. For the exact definition, see the Definition section.
Fact Query
Plain TableSource over FACT.
Note: This is only a symbolic example. For the exact definition, see the Definition section.
Product dimension (1 level)
Same single-level shape as the
tutorial.writeback.decimaltutorial —Productdim keyed onPRODUCT.KEYwith the displayed name fromPRODUCT.NAME.Note: This is only a symbolic example. For the exact definition, see the Definition section.
Region dimension (2 levels)
Regionis a two-levelExplicitHierarchyon a single denormalisedREGIONtable (no snowflake join):Country(L1) — keyed onREGION.COUNTRY_KEY,uniqueMembers = true. Each country is unique.City(L2, leaf) — keyed onREGION.CITY_KEY,uniqueMembers = false. Different countries can share a city name, but the (country, city) pair is unique.The fact joins on the leaf:
FACT.CITY = REGION.CITY_KEY. Aggregations across a country roll up its cities through the standard SQLGROUP BYpath.Note: This is only a symbolic example. For the exact definition, see the Definition section.
Writeback (FACTWB)
Two-dimensional cell coordinates. Every cell in this cube has a (Product, City) coordinate. A
Cell.setValue([Measures].[Amount], 99.95, ...)issued at an intermediateCountrymember is allocated across the country's cities (each city gets99.95 / N); a write at a specific city goes directly to that one leaf.Text writeback semantics. The
Commentsmeasure follows the text short-path: a single row at the cell's exact (Product, City-or-Country) coordinate; intermediate-level writes record the country'sCOUNTRY_KEYas the city attribute (sinceRegion's writeback attribute targets theCITYcolumn). At read time theListAggAggregatorre-aggregates everything through SQL.Both writeable measures share the same writeback table. Numeric and text writes interleave freely; each call produces its own row(s) tagged with a fresh UUID
IDand the sessionUSER.Note: This is only a symbolic example. For the exact definition, see the Definition section.
Cube C
One physical cube
CoverFACTwith twoDimensionConnectors (Product, Region), oneMeasureGroupholding the decimalAmountplus the textCommentsmeasure, and theFACTWBwriteback table.Note: This is only a symbolic example. For the exact definition, see the Definition section.
Definition
This file represents the complete definition of the catalog.
Tutorial Zip
This file contains the data-tables as csv and the mapping as xmi file.
Download Zip File