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

Changing a variable into a date

Started by kwirth, 09 Aug 2016 03:13:24 PM

Previous topic - Next topic

kwirth

I'm trying to figure out how to incorporate a year variable I have into a casting into a date.

I want to be able to type in the month and day, but insert the year that is in the data.

Ideally, I want to do something like this, but it doesn't work as is. Any thoughts?

cast('[YEAR]-01-09',date)

Lynn

Quote from: kwirth on 09 Aug 2016 03:13:24 PM
I'm trying to figure out how to incorporate a year variable I have into a casting into a date.

I want to be able to type in the month and day, but insert the year that is in the data.

Ideally, I want to do something like this, but it doesn't work as is. Any thoughts?

cast('[YEAR]-01-09',date)



cast( [YEAR] || '-01-09' , date )



cast( [YEAR] || '-' || ?SelectMonth? || '-' || ?SelectDay? , date )


Something along these lines might help although zero padding in front of the entered values might be something you have to deal with.

AnalyticsWithJay

One other solution is to try creating this expression using functions from your database vendor, because cast() is a locally-processed function, and could possibly degrade performance.