简体   繁体   English

在“搜索”中更改默认选项,然后在Cognos Analytics中选择“提示”

[英]Change default option in Search and Select Prompt in Cognos Analytics

I am trying to configure the Search And Select Prompt in Cognos Analytics (Release 6 and above) to change the default option from "Starts with any of these keywords" to "Contains any of these keywords" --> 3rd option. 我正在尝试配置Cognos Analytics(版本6及更高版本)中的“搜索并选择提示”,以将默认选项从“以这些关键字中的任何一个开始”更改为“包含这些关键字中的任何一个”->第三个选项。

All the documentation and information available over the internet uses a JavaScript code that works fine until Full Interactivity is enabled! 互联网上所有可用的文档和信息都使用JavaScript代码,在启用完全交互之前,该代码才能正常工作!

I know that I need to move the code a separate JS file and call it through a Custom Control of Page Module. 我知道我需要将代码移动到单独的JS文件中,并通过“页面模块的自定义控件”进行调用。 I tried both and looks like that the same JavaScript code won't work. 我尝试了两者,但看起来相同的JavaScript代码无法正常工作。

On the other hand, I've went in depth through the official documentation of "Scriptable Reports" from IBM which describes all technical details regarding the new Prompt API, but without any luck to understand how to simply change that option (I don't want to getValues, or clearValues, or setValues!. I simply want to change the default option) 另一方面,我深入研究了IBM的“脚本报告”的正式文档,该文档描述了有关新的Prompt API的所有技术细节,但没有运气去了解如何简单地更改该选项(我不会想要getValues或clearValues或setValues!。我只是想更改默认选项)

Any help would be highly appreciated! 任何帮助将不胜感激!

Thanks 谢谢

You will have to go outside of the Cognos Prompt API to manipulate the default Search & Select option. 您将必须脱离Cognos Prompt API才能操作默认的Search&Select选项。 My instructions below apply to 10.2, the only system I currently have access to. 我下面的说明适用于10.2,这是我当前有权访问的唯一系统。 Some of the steps may have changed for Cognos 11, but the concept is the same. 对于Cognos 11,某些步骤可能已更改,但是概念是相同的。

The first thing to do is to put an HTML object right before your Search & Select with the following code: 要做的第一件事是使用以下代码在您的Search&Select之前放置HTML对象:

<span id="test">

Next, put another HTML object right after the Search & Select with the following code: 接下来,使用以下代码在Search&Select之后放置另一个HTML对象:

</span>
<script>
document.getElementById('test').getElementsByTagName('input')[2].setAttribute('checked','');
</script>

This will select the 3rd option (index 2) in the Search & Select. 这将在“搜索和选择”中选择第三个选项(索引2)。

Finally, if you want the default to only be set on initial rendering and preserve any choice the user has made on rerprompt, you can modify the code as follows: 最后,如果希望仅在初始渲染时设置默认值,并保留用户在rerprompt上所做的任何选择,则可以按以下方式修改代码:

...
<script>
if (typeof initialized == 'undefined') {
    document.getElementById('test').getElementsByTagName('input')[2].setAttribute('checked','');
    initialized = true;
}
</script>

For more information on this technique, you can see my blog post here: 有关此技术的更多信息,您可以在这里查看我的博客文章:

Javascript: Running Code Only Once Javascript:仅运行一次代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM