Skip to content

Daanse Tutorial - Formatter Cell

Data cube with measures CellFormatter.

Database Schema

The cube defined in this example is based on a single table that stores all the data. The table, named Fact, contains two columns: KEY and VALUE. The KEY column acts as a discriminator, while the VALUE column holds the measurements to be aggregated.

xml
<roma:DatabaseSchema   id="_databaseSchema_cell">
  <tables xsi:type="roma:PhysicalTable" id="_table_fact" name="Fact">
    <columns xsi:type="roma:PhysicalColumn" id="_column_fact_key" name="KEY"/>
    <columns xsi:type="roma:PhysicalColumn" id="_column_fact_value" name="VALUE" type="Integer"/>
  </tables>
</roma:DatabaseSchema>

Note: This is only a symbolic example. For the exact definition, see the Definition section.

Query

This example uses a TableQuery, as it directly references the physical table Fact.

xml
<roma:TableQuery  id="_query_fact" table="_table_fact"/>

Note: This is only a symbolic example. For the exact definition, see the Definition section.

CellFormatter

    Specialized formatter for controlling the presentation of cell values in analytical grids.
    Cell formatters use a reference to a class formatter like mondrian.rolap.format.CellFormatterImpl implementing the CellFormatter interface
xml
<roma:CellFormatter  id="_cellFormatter" ref="mondrian.rolap.format.CellFormatterImpl"/>

Note: This is only a symbolic example. For the exact definition, see the Definition section.

Measure1

    Measure with CellFormatter. The measure references the `VALUE` column and uses the `SUM` aggregation function.
xml
<roma:SumMeasure  id="_measure_Measure1" name="Measure1" cellFormatter="_cellFormatter" formatString="Standard" column="_column_fact_value"/>

Note: This is only a symbolic example. For the exact definition, see the Definition section.

Cube with Measures CellFormatter

In this example, the measure has a CellFormatter. The measure references the VALUE column and uses the SUM aggregation function.

xml
<roma:PhysicalCube   id="_cube_cellFormatter" name="CubeOneNumericMeasureDifferentDataTypes" query="_query_fact">
  <measureGroups>
    <measures xsi:type="roma:SumMeasure" id="_measure_Measure1" name="Measure1" cellFormatter="_cellFormatter" formatString="Standard" column="_column_fact_value"/>
  </measureGroups>
</roma:PhysicalCube>

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.

xml
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:roma="https://www.daanse.org/spec/org.eclipse.daanse.rolap.mapping">
  <roma:Catalog description="Cell formatter configurations" name="Daanse Tutorial - Formatter Cell" cubes="_cube_cellFormatter" dbschemas="_databaseSchema_cell"/>
  <roma:DatabaseSchema id="_databaseSchema_cell">
    <tables xsi:type="roma:PhysicalTable" id="_table_fact" name="Fact">
      <columns xsi:type="roma:PhysicalColumn" id="_column_fact_key" name="KEY"/>
      <columns xsi:type="roma:PhysicalColumn" id="_column_fact_value" name="VALUE" type="Integer"/>
    </tables>
  </roma:DatabaseSchema>
  <roma:TableQuery id="_query_fact" table="_table_fact"/>
  <roma:PhysicalCube id="_cube_cellFormatter" name="CubeOneNumericMeasureDifferentDataTypes" query="_query_fact">
    <measureGroups>
      <measures xsi:type="roma:SumMeasure" id="_measure_Measure1" name="Measure1" cellFormatter="_cellFormatter" formatString="Standard" column="_column_fact_value"/>
    </measureGroups>
  </roma:PhysicalCube>
  <roma:CellFormatter id="_cellFormatter" ref="mondrian.rolap.format.CellFormatterImpl"/>
</xmi:XMI>

Tutorial Zip

This file contains the data-tables as csv and the mapping as xmi file.

Download Zip File

Released under the Eclipse Public License 2.0