我正在开发我的第一个沙箱Hyperion规划应用程序,我很好奇是否有可能在规划表单中创建动态下拉框。例如,如果表单要求计划员选择团队/成本中心,那么公司和货币就可以创建一个动态的表单:
当计划员选择特定成本中心时,公司和货币下拉框将动态填充给定所选成本中心/团队的所有有效选择。
答案 0 :(得分:1)
如果没有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;
}
}