问题描述
我想知道是否可以在值提示中显示来自提示宏的默认值。我的提示宏看起来像这样“#prompt('pMonth','MUN','[PrevIoUs Month]')#” 所以我在值提示中的目标是显示 202103 而不是我命名为“上个月”的标题文本名称
我尝试使用 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>
非常感谢所有解决方案、技巧和想法。
最好的问候, 红宝石
解决方法
对于以完全交互方式运行的 Cognos Analytics,您可能需要一个页面模块。查看IBM's Scriptable Reports documentation for Cognos Analytics。您需要制作脚本以使用当前参数值作为默认值(如果可以的话),然后从数据故障转移到您的默认值。您可能需要将其与自定义控件集成,以便能够从数据中获取该默认值。