Cognos:在条件变量表达式中使用 DataItem 值

发布于 2024-08-22 04:19:43 字数 493 浏览 5 评论 0原文

我有一个列表,其中有一列“年份”。我想让最近一年(2010 年)在“年份”列中显示为粗体。我尝试了这个表达式

IF ( [myQuery].[YEAR] = [myQuery].[RECENT_YEAR]) THEN ( "RecentYearBold" )

其中 [RECENT_YEAR] 是一个具有表达式 maximum([YEAR]) 的 DataItem

这会引发错误,并且不允许我在条件中使用 DataItem变量表达式。有人可以帮忙吗?

我得到的错误:

RSV-VAL-0002 表达式无效 IF ( [myQuery].[YEAR] = [myQuery].[RECENT_YEAR] ) THEN (“最近年份粗体”)。 CRX-API-0005 位置“34”或其周围出现错误。名为“[myQuery].[RECENT_YEAR]”的变量无效。

I've a list which has a column 'YEAR'. I want to make the recent year(2010) appear bold in that 'YEAR' column. I tried this expression

IF ( [myQuery].[YEAR] = [myQuery].[RECENT_YEAR]) THEN
( "RecentYearBold" )

where [RECENT_YEAR] is a DataItem with the expression maximum([YEAR])

This throws me an error and it doesn't allow me to use the DataItem in conditional variable expression. Can anybody help?

Error I get:

RSV-VAL-0002 Invalid expression IF ( [myQuery].[YEAR] = [myQuery].[RECENT_YEAR] ) THEN
( "RecentYearBold" ). CRX-API-0005 An error on or around the position '34'. The variable named '[myQuery].[RECENT_YEAR]' is invalid.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

时光病人 2024-08-29 04:19:43

问题在于,Cognos 8 从查询中删除了报表对象(在您的情况下为 List 对象)未使用的变量。如果您希望它们可用,您需要将查询项添加到报表对象的数据属性中。请注意,您可以将该项目添加到您的列表中(但随后您必须隐藏它,这很丑陋)。最好指示 Cognos 将查询项包含在报表对象中,以避免不必要的花招。

此链接更详细地解释了问题和解决方案: http://www- 01.ibm.com/support/docview.wss?uid=swg21339433

The problem is that Cognos 8 strips away variables from a query that are not being used by the report object (in your case the List object). IF you want them available you need to add the query item to the data properties of the Report Object. Note that you CAN add the item to your list (but then you have to hide it, this is ugly). It's much better to instruct Cognos to include the query item in the report object to avoid unnecessary gimmicks.

This link explains the problem and solution in greater detail: http://www-01.ibm.com/support/docview.wss?uid=swg21339433

紅太極 2024-08-29 04:19:43

我能够通过采取以下方法来完成您正在尝试的事情(在出现与您相同的错误之后):

  1. 我创建了 [recent_year] 列,如下所示:
    最大值(报告的[cognos_test].[year])。 (如果需要,您可以使用不同的范围。)
  2. 在 Conditon Explorer 中创建了一个名为 最近一年 的布尔变量,其表达式如下:[Query1].[year] = [Query1].[ centre_year]
  3. 我将年份列添加到列表中,设置样式变量 = 最近一年,并在最近一年 = true 时将条件粗体格式应用于年份列>
  4. 此时,当我执行报告时,我收到了与您相同的错误。验证报告提供了更多信息,这表明 [Query1].[recent_year] 字段也需要位于列表中。当我将其添加到列表中时,条件格式起作用了。 (真的不知道为什么会出现这种情况,但我同意了。)
  5. 要隐藏 [recent_year] 列(同时仍将其保留在列表中),您可以设置“Box Type”属性将cent_year 列的“列表列正文”和“列表列标题”对象设置为“无”。

I was able to accomplish what you are trying (after getting the same error you did) by taking the following approach:

  1. I created the [recent_year] column to be the following:
    maximum ([cognos_test].[year] for report). (You could use a different scope, if desired.)
  2. Created a boolean variable in Conditon Explorer called recent year with the following expression: [Query1].[year] = [Query1].[recent_year]
  3. I added the year column to the list, set the style variable = recent year and applied the conditional bold formatting to the year column when recent year = true
  4. At this point, when I executed the report, I received the same error you did. Validating the report gave a little more information, which indicated that the [Query1].[recent_year] field needed to be in the list as well. When I added it to the list, the conditional formatting worked. (Really not sure why this was the case, but I went with it.)
  5. To hide the [recent_year] column (while still leaving it in the list) you can set the "Box Type" property for the "List Column Body" and "List Column Title" objects for the recent_year column to "None".
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文