This page provides a description of how we can add a measure. The techniques employed are generic examples that can be extended, adapted, and repeated for any use case that we need. To avoid forking library code, all extensions are made by subclassing the relevant configuration class from theDocumentation Index
Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
Use this file to discover all available pages before exploring further.
cvarc-starter library module and wiring the subclass into your project’s ApplicationConfig in the cvarc-application module.
Step 1 - extend the cube selection
If your new measure depends on a field that is not yet reachable through the cube’s selection, extend the selection so the field can be found. The selection is built increateBASelection() / createSASchemaSelectionDescription(), which live in BACubeConfig / SACubeConfig (in the cvarc-starter library module). Use the subclass pattern described in Adding a Hierarchy — Step 2: create a CustomBACubeConfig extends BACubeConfig (or CustomSACubeConfig extends SACubeConfig) in cvarc-application/src/main/java/com/activeviam/cvarc/application/cfg/extensions/, annotated with @Configuration and @Primary, and override the selection method to add the reference to your new field’s store.
Make sure that any new field added to the selection does not exist in the selection already, and that it points to a corresponding field in a datastore.
Step 2 - define the measure
ExtendBAMeasureBuilder (or SAMeasureBuilder) to add new measures. Place the new class in cvarc-application/src/main/java/com/activeviam/cvarc/application/cfg/extensions/.
Step 3 - wire the extended measure builder into the cube config
To swapBAMeasureBuilder::measures for ExtendedBAMeasureBuilder::measures, extend the cube config rather than editing it in place. If you already created CustomBACubeConfig for Step 1, override configureCubeBuilder() in the same class; otherwise create it now in cvarc-application/src/main/java/com/activeviam/cvarc/application/cfg/extensions/.
CustomBACubeConfig to the @Import list of ApplicationConfig in cvarc-application/src/main/java/com/activeviam/cvarc/application/cfg/ApplicationConfig.java.