Array of possibilities in Groovy is endless. In Today’s world, you can build advanced business logic in ASO cubes while you are taking advantage of ASO capabilities. Classical way of building business logic in BSO and moving data to ASO cube for reporting and fast aggregations are still valid, however Groovy is changing the game and bringing multiple other options you may consider while you are developing your application.
Existing out of the box version copy in PBCS does not support ASO cubes. You have to consider the size of data and assess the business case carefully before attempting to copy large datasets. If you want to go ahead with version copy in ASO cubes, you can review following example.
/RTPS: {SourceVersion}{TargetVersion}/ String SourceVersion = rtps.SourceVersion String TargetVersion = rtps.TargetVersion Cube asocube = operation.application.getCube("ASOCube"); CustomCalcParameters calcParameters = new CustomCalcParameters(); calcParameters.pov = 'Crossjoin(Crossjoin(Crossjoin(Crossjoin(Crossjoin(Crossjoin(Crossjoin(Crossjoin({[Qtr1],[Qtr2],[Qtr3],[Qtr4]},{Descendants([All Years],[All Years].Levels(0))}),{[... calcParameters.sourceRegion = '{([' + SourceVersion.replaceAll('"',"") + '])}' calcParameters.script = '[' + TargetVersion.replaceAll('"',"") + '] := ([' + SourceVersion.replaceAll('"',"") + ']);' asocube.executeAsoCustomCalculation(calcParameters)
You have to update calcParameters.pov according to your application’s dimensions. I have left Period and Year dimensions as an example, you need to add or remove Crossjoin as needed. If you are familiar with MDX, example and the syntax will be much easier.
There are 2 run time prompts defined, SourceVersion and TargetVersion. asocube.executeASOCustomCalculation method will take the parameter calcParameters where we defined pov, sourceRegion and script itself.
pov: MDX set defining the context region in which the calculation is performed. The calculation script will be executed once for every cross-product in the POV region.
sourceRegion: MDX set specifying the region of the cube referred to by the formulas in the script. At a minimum, the source region should include all members from the right-hand sides of the assignment statements in the custom calculation script.
script: Custom calculation scripts are expressed in MDX