微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Cognos Report Studio:如何根据查询输出更改显示的图像?

如何解决Cognos Report Studio:如何根据查询输出更改显示的图像?

使用 Cognos Report Studio

我有一个返回两个数字的查询,我需要根据这两个数字显示向上、向下或直线箭头。图像存储在服务器中。

这是我的条件:

If (num1 > num2) then (green arrow)
If (num1 < num2) then (red arrow)
If (num1 = num2) then (straight arrow)

我已尝试使用名为 stringvImage 变量并满足以下条件:

case
   when (num1 > num2) then (GreenArrow.png)
   when (num1 < num2) then (RedArrow.png)
   when (num1 > num2) then (StraightArrow.png)
end

num1num2 作为查询结果。 那些 .png 文件是我的答案列表。

在我的报告中,我将 Image 布局元素设置为 URL Source Variable 变量。

当我运行 HTML 时,报告元素返回空白。

我尝试在 URL 源变量对话框中选择和取消选择值,但似乎没有任何效果

有什么建议吗?

解决方法

鉴于要求只是向上和向下箭头,我真的根本不会理会图像。只需将 ascii 箭头复制到 if 子句中。 https://unicode-table.com/en/sets/arrow-symbols/#up-arrows。完成后,使用条件样式调整字体颜色。

case
   when (num1 > num2) then (▲)
   when (num1 < num2) then (▲)
   when (num1 > num2) then (▲)
end
,

您不需要定义变量。

对于您的图片列:
设置 URL 来源 | 报告表达式的源类型属性。
将表达式设置为如下所示:

- name: Download connector scripts
  get_url:
    url: "http://example.com/{{ item.key }}"
    dest: "{{ item.value }}"
  loop: "{{ files | dict2items }}"
  vars:
    files:
      filename1: "/path/to/dest/dir/"
      filename2: "/path/to/dest/dir/"

调整以适应图像的实际路径。
您还需要考虑如何制作 URL 对输出格式的影响。 HTML 图像 URL 由客户端浏览器评估。 Excel 或 PDF 输出中的图像 URL 由 Cognos 服务评估。图像可能以一种输出格式而不是另一种格式出现。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。