Cognos:在条件变量表达式中使用 DataItem 值
我有一个列表,其中有一列“年份”。我想让最近一年(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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题在于,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
我能够通过采取以下方法来完成您正在尝试的事情(在出现与您相同的错误之后):
最大值(报告的[cognos_test].[year])
。 (如果需要,您可以使用不同的范围。)最近一年
的布尔变量,其表达式如下:[Query1].[year] = [Query1].[ centre_year]
最近一年
,并在最近一年 = true
时将条件粗体格式应用于年份列>[Query1].[recent_year]
字段也需要位于列表中。当我将其添加到列表中时,条件格式起作用了。 (真的不知道为什么会出现这种情况,但我同意了。)[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:
maximum ([cognos_test].[year] for report)
. (You could use a different scope, if desired.)recent year
with the following expression:[Query1].[year] = [Query1].[recent_year]
recent year
and applied the conditional bold formatting to the year column whenrecent year = true
[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.)[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".