要在 Financial Consolidation and Close 表单中输入和显示年初至今 (YTD) 数据,可以使用以下方法之一:
要创建直接向 FCCS_YTD 成员输入数据的 Groovy 规则:
在 Calculation Manager 中添加名为 "PreFormLoad" 的按需规则。
将该按需规则的脚本类型更改为“Groovy 脚本”。
将以下代码添加到 "PreFormLoad" 规则中:
operation.grid.dataCellIterator("FCCS_YTD").each { DataCell cell -> if (!cell.crossDimCell("FCCS_YTD_Input") && cell.isReadOnly())cell.forceEditable=true}保存和验证 "PreFormLoad" 规则。
为 "PreFormLoad" 规则提供默认的运行时提示值,如下所示:
合并:"Entity Input"
货币:"Entity Currency"
实体:"FCCS_Global Assumptions"
期间:"Jul"
方案:"Actual"
年份:"FY19"
对于 "PreFormLoad" 规则的所有六个运行时提示,选中隐藏和用作覆盖值选项。
保存、验证和部署 "PreFormLoad" 规则。
在 Calculation Manager 中添加名为 "PreFormSave" 的按需规则。
将该按需规则的脚本类型更改为“Groovy 脚本”。
将以下代码添加到 "PreFormSave" 规则中:
def app = operation.application
Cube cube = operation.cube
Member ytdInputMember =
app.getDimension(DimensionType.VERSION).getMember("FCCS_YTD_Input")
Collection<DataCell> pendingYtdCells =
operation.grid.dataCellIterator("FCCS_YTD").findAll {DataCell ytd -> if (ytd.edited) {
def ytdInput = ytd.crossDimCell(ytdInputMember.name)
ytdInput?.formattedValue = ytd.formattedValue
ytd.setEdited(false)
return ytdInput == null
}
}
if (pendingYtdCells) {
DataGridBuilder builder = cube.dataGridBuilder("MM/DD/YYYY")
Set<String> allDimNames = set(app.getDimensions(cube)*.name)
List<String> rowDimNames = set((allDimNames -
operation.grid.pov*.dimName) - [ytdInputMember.dimension.name]) as List
builder.addPov(operation.grid.pov.findAll({it.dimName !=
ytdInputMember.dimension.name})*.uniqueMbrName as String[])
builder.addColumn(ytdInputMember.name)
pendingYtdCells.each {DataCell cell ->
builder.addRow(rowDimNames.collect
{cell.getMemberName(it, MemberNameType.UNIQUE_NAME)},
[cell.formattedValue])}
DataGridBuilder.Status status = new DataGridBuilder.Status()
builder.build(status).withCloseable {grid -> cube.saveGrid(grid)}
}
Set<String> set(Collection<String> names) {
Set<String> set = new TreeSet<>(String.CASE_INSENSITIVE_ORDER)
set.addAll(names)
return set
}
保存和验证 "PreFormSave" 规则。
为 "PreFormSave" 规则提供默认的运行时提示值,如下所示:
合并:"Entity Input"
货币:"Entity Currency"
实体:"FCCS_Global Assumptions"
期间:"Jul"
方案:"Actual"
年份:"FY19"
对于 "PreFormSave" 规则的所有六个运行时提示,选中隐藏和用作覆盖值选项。
保存、验证和部署 "PreFormSave" 规则。
添加一个名为 "YTD_Test_1" 的表单,行上有 "FCCS_Periodic" 和 "FCCS_YTD",如下所示:
示例 YTD 表单

单击业务规则选项卡,并将 "Consol – Rule – PreFormSave" 和 "Consol – Rule – PreFormLoad" 移到右侧。对于 "Consol – Rule – PreFormSave" 规则选中保存前运行,对于 "Consol – Run – PreFormLoad" 规则选中加载后运行。屏幕应显示如下内容:
示例业务规则

保存并单击完成。
注意:这些步骤会将 "Actual"/ "FY19" "Jul" "FCCS_Global Assumptions" 数据标记为“已更改”。请确保处理单元已启动并处于“未锁定”状态。这仅适用于此原型。实际实施时将没有这些限制。
打开 "YTD_Test_1 form" 并为 FCCS_YTD 添加值,如下所示:
示例 YTD 值

保存表单。将使用相应的周期性值填充 FCCS_Periodic,如下所示:
已填充的示例 YTD 表单
