- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
因此,我在报告中使用了 jQuery,并且我有一套报告,由于 jQuery 的帮助,所有报告一次全部加载,因此客户感觉转换速度更快,因为他们不必在每次单击之间等待。我希望能够根据客户使用的提示更改所有报告。因此,如果他们选择特定的一天,套件中的所有报告都将更改为该天。或者,如果他们选择了特定区域,则所有报告都会发送到该区域。这样客户就不必在每个报告的提示中加载参数。我想知道是否有办法做到这一点。我已经看过了,但没有发现任何东西。
编辑..因此,在我的报告中,包含所有 iframe 和我命名为changeMonth 的值提示,我有这个 JS
<script>
var report = cognos.Report.getReport("_THIS_");
var radio = report.prompt.getControlByName('monthChange');
var currentRadioValue = radio.getValues()[0]; //Get initial value object
radio.setValidator(validateRadio); //Define function to validate prompt
function validateRadio(values) {
if (values && values.length > 0 && values[0].use != currentRadioValue.use) { //Only do anything if control has value and has changed
currentRadioValue = values[0]; //Assign new value for later comparison
for (var i=0; i<window.frames.length; i++) { //Loop through all iFrames
window.frames[i].changeValue(values[0].use); //Call the changeValue function passing in the radio button value
}
}
return true; //Indicates the prompt is valid
}
</script>
在我想要 iframe 的报告中,我有一个值提示,它是一个下拉列表,其中 HTML 标记中包含此代码。
<script>
function changeValue(str){
var report = cognos.Report.getReport("_THIS_"); //Grab a handle for the report
var control = report.prompt.getControlByName('monthChange'); //Grab a handle for the prompt control
control.addValues([{"use":str,"display":str}]); //Change the prompt to the passed in value
report.sendRequest(cognos.Report.Action.REPROMPT); //Reprompt the page
}
</script>
如果重要的话,它们都是下拉列表。我看到您将它们列为单选按钮,所以我稍后会在这里尝试一下,并让您知道这是否改变了任何内容。但是我如何设置它,我还应该做其他事情吗?
最佳答案
我可以通过在每个子报告中创建一个 JavaScript 函数来实现此功能,该函数更改查询所依赖的隐藏提示值,然后重新提示页面。以下是每个子对象中需要的代码部分:
child 报告代码
<script>
function changeValue(str){
var report = cognos.Report.getReport("_THIS_"); //Grab a handle for the report
var control = report.prompt.getControlByName('controlname'); //Grab a handle for the prompt control
control.addValues([{"use":str,"display":str}]); //Change the prompt to the passed in value
report.sendRequest(cognos.Report.Action.REPROMPT); //Reprompt the page
}
</script>
这利用了 Cognos 版本 10.2 中添加的 Cognos JavaScript Prompt API。 getReport、getControlByName、addValues 和 sendRequest 函数都是 Cognos 提供的函数,目的是让 JavaScript 中的提示处理变得更容易。这里有更多信息:
Cognos JavaScript Prompt API documentation
在容器报告中,我创建了一个 Cognos 单选按钮值提示。我对 JavaScript 进行了编码,以利用 API 中 Cognos 提供的内置 onchange 验证 Hook 在单选按钮发生更改时运行代码。该代码循环遍历所有 iFrame,并调用上面在每个子报表中定义的函数,传入所选单选按钮的值。
容器报告代码
<script>
var report = cognos.Report.getReport("_THIS_");
var radio = report.prompt.getControlByName('radio');
var currentRadioValue = radio.getValues()[0]; //Get initial value object
radio.setValidator(validateRadio); //Define function to validate prompt
function validateRadio(values) {
if (values && values.length > 0 && values[0].use != currentRadioValue.use) { //Only do anything if control has value and has changed
currentRadioValue = values[0]; //Assign new value for later comparison
for (var i=0; i<window.frames.length; i++) { //Loop through all iFrames
window.frames[i].changeValue(values[0].use); //Call the changeValue function passing in the radio button value
}
}
return true; //Indicates the prompt is valid
}
</script>
请注意,在上面的代码中,字符串“controlname”和“radio”对应于相关提示控件的 Name 属性。默认情况下,Cognos 不会为提示控件指定名称。因此,您必须在创建后提供名称。无论您给它们起什么名称,脚本都必须进行相应的调整,以允许 JavaScript 访问它们的 Cognos Prompt API 对象。
可以修改此技术,以从 Cognos 中可用的各种提示控件中获取输入。此外,理论上,容器甚至根本不必是 Cognos。它可以是一个独立的网页,其中包含当标准 HTML onchange 事件触发时调用 iFrame 中的 JavaScript 函数的控件。唯一需要注意的是,由于安全限制,浏览器不允许从具有与 iFrame 不同域的容器调用 iFrame 内的函数。这是设计解决方案时需要考虑的事情。
关于javascript - Cognos 将值传递给所有提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25168822/
我在 data warehousing 做了一门类(class)和 data mining , 我有兴趣去 Cognos business intelligence道路。但是,我需要对找不到的数据进行
“Cognos TM1”和“Cognos 10 BI”之间有什么区别? 哪一个被 IBM 视为 BI 工具? 最佳答案 “Cognos TM1”和“Cognos 10 BI”之间存在巨大差异! Cog
我在 Cognos 中有一个查询表达式,我需要将过去的日期与当前日期进行比较。我在函数列表中没有看到函数,否则我不确定如何将查询日期放入查询对象中。 如何在查询中使用当前日期? 最佳答案 根据您的数据
是否可以计算 Cognos 报告中的百分比变化? 目前,我有一个交叉表,其中包含年份作为行中的列和小部件,并计算总收入。我正在计算每年的百分比增长。 Cognos 新手,但我可以使用其他工具完成此操作
根据这篇文章, http://www.ibm.com/developerworks/data/library/cognos/development/how_to/page565.html#downlo
请告诉我 Cognos 中有哪些可用的 API? 将 cognos 报告公开为移动应用程序的 Web 服务需要哪些 API? 提前致谢。 最佳答案 有一些 API 用于在 Cognos 中编排事件或检
在 Report Studio 中将值提示更改为多选值提示,提供单选功能。如何获得多选功能? 最佳答案 查看与提示关联的参数。现在去看看如何使用该参数来过滤报告中的查询。如果您将过滤器设置为:- [命
我有一个查询项,它按格式为 'YYYYMM' 的日期列过滤记录。到目前为止,我已经在 Detail filters 中对值 [DateCol] = '201406' 进行了硬编码,以获取当前的月份和年
我使用的是 Cognos 10.1,并且我有一个报告,该报告使用两个查询,每个查询都具有相同的主键。 查询 1:UniqueIds 查询2:详细信息 我不确定如何判断是否最好使用带有 PrimaryK
我有一个交叉表报告,可以计算我的产品的故障率;它有两个度量(PASSCOUNT、FAILCOUNT)和一个计算 FAILRATE(FAILCOUNT/PASSCOUNT+FAILCOUNT) 报告布局
我已将报告从 Cognos 10.2.2 迁移到 Cognos“11.0.13.1 LTS”版本。管理提示页面的 java 脚本目前在迁移到 11 后被破坏。这在 10.2.2 上运行良好。Cogno
我有一个引用参数“Year_Parameter”的值提示,以及一个包含一列(数据项表达式)的列表,该列表以这种方式引用与值提示相同的参数: #prompt('Year_Parameter')# 值提示
此问题适用于 Cognos Report Studio 版本 8.3 至 10.1.1。 在 Report Studio 8.3 中,我针对 MySQL 5.1 数据源运行了这个原始 SQL 查询:
我想在 cognos 中给出一个模式。像这样 我的号码:12.20 我想要的号码:12.2 我想删除 0 我如何给出模式。 最佳答案 如果未提及数据格式,则默认格式将处理尾随零。 但是,如果您使用某种
我有两个文本框提示,我需要验证它们是否只接受数字或空字段,如果您输入数字或空字段以外的任何内容,则应禁用运行按钮。 oCR = cognos.Report.getReport('_THIS_'); v
我有这份按列城市分组的报告。当我将总计添加到金额字段时,它不会显示每个城市的小计...最后只显示总计。 如何在 Cognos Report Studio 中添加小计行? 最佳答案 您得到了一个简单的列
除了 Cognos 之外,在 Java 中使用多维数据集设计器有哪些不同的选择?基本上我需要看到一个多维立方体,并且用户必须能够选择要作为过滤依据的列。 最佳答案 您可能想看看 Pentaho 这是一
我是一名 Cognos 开发人员,但我在“日期提示”方面遇到了麻烦。我有一个“日期提示”,其中在“选择 UI”中选择了“编辑框”选项,我希望当用户更改所选日期时触发 onchange 事件。现在我正在
我有一个 Cognos 图表,我希望能够打开一个标签,仅显示以条件格式显示的条形图的金额(从下拉列表中选择的中心)。 我找到了一种方法来打开所有标签,并使用 Cognos 图表关闭所有标签 - 显示值
因此,我在报告中使用了 jQuery,并且我有一套报告,由于 jQuery 的帮助,所有报告一次全部加载,因此客户感觉转换速度更快,因为他们不必在每次单击之间等待。我希望能够根据客户使用的提示更改所有
我是一名优秀的程序员,十分优秀!