// Capture the edited periods and products Set editedMembers = [] operation.grid.dataCellIterator({DataCell cell -> cell.edited}, MemberNameType.ESSBASE_NAME).each { DataCell cell -> editedMembers << cell.periodName << cell.getMemberName("Product") } if(editedMembers.size() == 0){ println("No edited cells found!") return; } // Generate the calc script to calculate revenue for the products whose volumes were edited and to count and return the number of cells calculated String calcScript = """ VAR numCellsCalculated = 0; Fix(${cscParams(operation.grid.pov, editedMembers)}) "OFS_Calculated" ( "OFS_Product Revenue" = "OFS_Volume" * "OFS_Avg Selling Price"; numCellsCalculated = numCellsCalculated + 1; ) EndFix; Fix(${cscParams(operation.grid.pov, editedMembers)}) "OFS_Calculated" ( @RETURN(@HspNumToString(numCellsCalculated), ERROR); ) EndFix; """ Cube cube = operation.application.getCube("OEP_FS") try { cube.executeCalcScript(calcScript) } catch(CalcScriptException e) { println("The following calc script was executed by $operation.user.fullName: \n $calcScript") println("Total number of cells calculated: $e.atReturnMessage") }