If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

What is wrong in this Expression?

Started by neverping, 10 Oct 2013 07:47:27 AM

Previous topic - Next topic

neverping

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

Lynn

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'