我正在开发我的第一个沙盒 Hyperion 规划应用程序,我很好奇是否可以在规划表单中创建动态下拉框。例如,如果表格要求计划者选择团队/成本中心、公司和货币,是否可以创建一个动态的表格,以便:
当计划员选择特定成本中心时,公司和货币下拉框会动态填充给定所选成本中心/团队的所有有效选项。
如果没有 Hyperion 在我面前,我不记得我是否得到了所有语法正确,但它应该非常接近这个。
在 Dropdown1 OnChange 脚本中:
var objDD1 = this;
var objDD2 = ActiveDocument.Sections['Dashboard'].Shapes['Dropdown2'];
var value1 = 'Selection';
var objTable1 = ActiveDocument.Sections['Table'];
var objColumn1 = objTable1.Columns['List_Items'];
var value2 = 'Selection2';
var objTable2 = ActiveDocument.Sections['Another Table'];
var objColumn2 = objTable2.Columns['List_Items'];
// go through this dropdown
for(var x=1; x<=objDD1.Count; x++)
{
// stop when you get to the item that's selected
if(objDD1.Item(x) == objDD1.SelectedIndex)
{
// pick the correct list
switch(objDD1.Item(x))
{
case value1:
var objTable = objTable1;
var objColumn = objColumn1;
break;
case value2:
var objTable = objTable2;
var objColumn = objColumn2;
break;
default:
Console.Writeln('Error with selection');
}
// empty the target dropdown
objDD2.RemoveAll();
// Go through all the rows of the table
for(var y=1; y<=objTable.RowCount; y++)
{
// from the column, go through each cell in order
var value = objColumn.GetCell(y);
// add the contents of that cell to the dropdown options
objDD2.Add(value);
}
// dropdowns only have one selection.
// once that's found, stop the for loop
break;
}
}