Dayalan Punniyamoorthy Blog

Showing posts with label reuse. Show all posts
Showing posts with label reuse. Show all posts

Sunday, May 7, 2023

EPBCS Groovy Rule series-2, One rule for multiple Data forms do the calculation!

In this second part of the blog, let's explore how to reuse the same Calculation Manager Groovy rule by attaching the rule to multiple data forms to perform different actions in each data form.

The Groovy Calculation Manager rule is dynamic, it gets the account member from the data form, and depending on the selected account member the rule will perform a specific calculation. 




We can use the same rule and attach it to multiple Data forms. 

Let's see how the rule looks,

// Capture the edited periods and products
Set<String> editedMembers = []
operation.grid.dataCellIterator({DataCell cell -> cell.edited}, MemberNameType.ESSBASE_NAME).each { DataCell cell ->
        //editedMembers << cell.periodName << cell.getMemberName("Product")
        editedMembers << cell.periodName << cell.getMemberName("Years") << cell.getMemberName("Product") << cell.getMemberName("Customer")
    }
if(editedMembers.size() == 0){
    println("No edited cells found!")
    return;