With groovy you can create virtual grids in your business rules that can read directly from your application’s cubes. Please refer to my earlier blog Rest API – Export Data Slices where we explored the option to connect epm cloud cubes and read data intersections via Rest APIs. I will be talking about accessing same data intersection from business rules.

Start with creating an object of Cube and of DataGridDefinitionBuilder
Cube cube = operation.application.getCube("CubeName"); DataGridDefinitionBuilder gridBuilder = cube.dataGridDefinitionBuilder()
Need to use the methods of gridBuilder to define the POV, rows and columns.
gridBuilder.addPov(['Years', 'Scenario', 'Version','Territory','Product','Accounts','Employees','Currency'], [['FY20'], ['Plan'],['Working'], ['No Entity'], ['No Product'], ['No Accounts'], ['No Employees'], ['GBP']]) gridBuilder.addRow(['Measures'], [ ['Revenue'] ]) gridBuilder.addColumn(['Period'], [ ['YearTotal'] ])
gridBuilder.build() will return an object of DataGridDefinition which can be used to create the object of DataGrid.
DataGridDefinition dataGridDefinitionobj = gridBuilder.build() DataGrid dataGridobj = cube.loadGrid(dataGridDefinitionobj, false)
dataGridobj is the object you can use to read the returning data point
if(dataGridobj.size() != 0){ dataGridobj.dataCellIterator().each { println(it.getData()) } }
You can see 1200 from the job console log after launching this business rule.
