The API
ActivePivot cube builder
Copper calculations are specified in the withCalculations(Consumer<ICopperContext>)
method available in the cube builder.
The entry point of Copper API is the "Copper context" or simply the "context", which is aware of the already defined measures and hierarchies. Copper measures and hierarchies are created with the API and then published to the context like so:
.withCalculations(context -> {
// Here you can describe your calculations with the context
})
We see in the above snippet that all the Copper measures will be defined in a single lambda method. For the sake of brevity, all examples will from now on only show its body.
Once the user has specified their calculations in the lambda, the new measures and hierarchies will be added to the pivot description before it is started.
The Copper class provides all of the static methods which serve as an entry point for measure and hierarchy creation. All created measures are objects that implement the same interface CopperMeasure
representing the basic bricks of Copper calculations that give you acces to methods to build more complex calculations.
Inside the lambda itself, a user may also reuse previously published measures or hierarchies for subsequent Copper calculations (pseudo-code):
CopperMeasure m1 = Copper.method(); // Create a measure with a static method from the Copper class
m1.publish(context);
// m1 is now available in following calculations
CopperMeasure m2 = m1.function(); // Apply function() on m1 to create a new measure
m2.publish(context);
// m2 is now available in following calculations
All of your measures can be declared within this lambda, in Copper, at the same place and in the same way. This obviously includesCopperMeasures
, but also native measures, aggregated measures, as well as legacy post-processors.