Hi guys,
i am facing an error on function below. This function works fine, but when need validate the report cames with erros and my cliente said this is problem to acceppt.
Follow the expression.
substring(substring(timestamp2string(_add_years (date2timestamp(AsOfDate ());-1));3;4);1;2)
+ 'A'
Returns 12 A ( current year + letter A)
There is another awaya to return this on Cognos..based Oracle database.
Thanks. :D
The syntax you are showing is for a layout calculation rather than a query calculation. Not sure if that is your intention or not, but the correct syntax would use commas instead of semi-colons and strings enclosed in double quotes rather than single quotes
substring(substring(timestamp2string(_add_years (date2timestamp(AsOfDate ()),-1)),3,4),1,2) + "A"
If you need a database calculation, this is an equivalent expression:
substring ( cast( extract(year, _add_years( current_date,-1) ), CHAR(4) ), 3, 4 ) + 'A'