Presentation Meta Data
The columns of CoPPer produce measures that can be queried in a cube, so they contain an additional API to customize the appearance of these measures. These includes:
- the formatter. The formatter is an advanced plugin key like the ones used in the cube description, like
DOUBLE[#,###.00]
. It will be used to produce the formatted value of this measure in the result of a MDX query. - the folder. This is the folder in which this measure will appear in the cube structure in the user interfaces.
- the measure group of this measure.
These can be changed on any column by doing for instance:
context
.createDatasetFromFacts()
.agg(Columns.sum("likes")
.withFormatter("DOUBLE[#,###.00;-#,###.00]")
.withinFolder("simple")
.withinMeasureGroup("likes"))
Since you will often need to use the same formatter or folder or measure group to many measures, we also added these methods directly on the context object. Calling BuildingContext.withFormatter
will produce a new BuildingContext
who will apply this formatter to all the created columns. This way the calculations description is shorter. You can thus do:
context
.withFormatter("DOUBLE[#,###.00;-#,###.00]")
.withinFolder("simple")
.withinMeasureGroup("likes")
.createDatasetFromFacts()
.agg(
Columns.sum("likes"),
Columns.min("likes"),
Columns.max("likes")
);
This way the three created columns will have the same formatter, folder and measure group.