如何在值提示 CA11 中显示提示宏的默认值?

时间:2021-04-07 06:30:15

标签: cognos cognos-11

我想知道是否可以在值提示中显示来自提示宏的默认值。我的提示宏看起来像这样“#prompt('pMonth','MUN','[Previous Month]')#” 所以我在值提示中的目标是显示 202103 而不是我命名为“上个月”的标题文本名称

enter image description here

我尝试使用 Cognos 10 中的旧 javascript,您可以在其中描述月份并指定它应该选择的索引,但该代码的问题是每次尝试更改为不同的月份时,报告都会重新运行并循环回到相同的索引值。

<script>
var theSpan = document.getElementById("A1");
var a = theSpan.getElementsByTagName("select");   /* This stmt return an array of all value prompts within span */
for( var i = a.length-1; i >= 0; i-- )  /* now loop through the elements */
{   var prompts = a[i];
if( prompts.id.match(/PRMT_SV_/))
 {  prompts.selectedIndex = 2;  } /* This selects the second options from top */
canSubmitPrompt();
}
</script>

非常感谢所有解决方案、技巧和想法。

最好的问候, 红宝石

1 个答案:

答案 0 :(得分:0)

对于以完全交互方式运行的 Cognos Analytics,您可能需要一个页面模块。查看IBM's Scriptable Reports documentation for Cognos Analytics。您需要制作脚本以使用当前参数值作为默认值(如果可以的话),然后从数据故障转移到您的默认值。您可能需要将其与自定义控件集成,以便能够从数据中获取该默认值。

相关问题