从cognos报告表达式中提取年份

从cognos报告表达式中提取年份,cognos,cognos-10,cognos-bi,cognos-8,Cognos,Cognos 10,Cognos Bi,Cognos 8,我想在报表表达式字段中提取当前年份、去年,但无法获取。 date2timestamp(Today())和Today() 这很适合约会 \u添加年(date2timestamp(Today()),1)和提取(“年”,Today()) 但这表明了错误。 我想在我的报告中动态显示2016、2015作为交叉选项卡节点的标题。如果使用布局计算,请尝试 substring(date2string(Today()),1,4) 本年度。及 string2int32(substring(date2string(

我想在报表表达式字段中提取当前年份、去年,但无法获取。
date2timestamp(Today())
Today()
这很适合约会

\u添加年(date2timestamp(Today()),1)
提取(“年”,Today())
但这表明了错误。
我想在我的报告中动态显示2016、2015作为交叉选项卡节点的标题。

如果使用布局计算,请尝试

substring(date2string(Today()),1,4)
本年度。及

string2int32(substring(date2string(Today()),1,4)) - 1
上一年度。

本年度:
extract('year',date2timestamp(today())

上一年度:
extract('year'),\u add_years(date2timestamp(today()),-1))


这将为您提供一个整数值,您可以使用日期项属性中的“普通数据格式”选项对其进行格式化,例如,如果需要,可以删除数千个逗号。

使用两个数据项进行查询

对于上一年,一个数据项将具有:

extract (year, _add_years(current_date, -1)) 
本年度:

extract (year, current_date).  

我得到错误
RSV-VAL-0002无效的表达式提取(年份,当前日期)。CRX-YXX-4010在表达式“extract(year,current_date)”中的位置8处或附近发现解析错误。
是否使用布局计算?我想动态显示交叉表节点成员。谢谢你的努力,但对我来说仍然不起作用:(试试Report Studio的内置日期current_date