COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Framework Manager => Topic started by: gosoccer on 21 Apr 2014 10:22:21 AM

Title: Framework Manager 10.2.1- Get Only the Last 30 days (NONE-CUBE)
Post by: gosoccer on 21 Apr 2014 10:22:21 AM
Folks,

The following query is sending me an error for getting the last 30 days.
within the Framework Manager Subject Query that is SQL based.

where

   and ((TRANSACTION.DATE_TIME) >=  trunc(SYSDATE)-30)
   and ((TRANSACTION.DATE_TIME) < trunc(SYSDATE) )
It is recommended that you view the query feedback on the "Query Information" tab.

RQP-DEF-0177 An error occurred while performing operation 'sqlPrepareWithOptions' status='-16'.
UDA-SQL-0358 Line 27: Syntax error near "-30".
Please help!
Title: Re: Framework Manager 10.2.1- Get Only the Last 30 days (NONE-CUBE)
Post by: MFGF on 21 Apr 2014 11:37:05 AM
Why are you trying to code this into the SQL rather than using a filter expression in the query subject definition?

Wouldn't the appropriate filter expression be:

[Your Namespace].[Your query subject].[DATE_TIME] between _add_days(current_date,-30) and current_date

Regards,

MF.
Title: Re: Framework Manager 10.2.1- Get Only the Last 30 days (NONE-CUBE)
Post by: gosoccer on 21 Apr 2014 12:26:32 PM
Thanks so much! Your code did the trick. I would love t know how to do the same using "Filter Expression"
Here is what I have but end up getting errors. Didn't know what to have the below to work without the
prompt requirements.

([DATE_TIME] >= to_date(#prompt('Begin_Date')#, 'YYYY-MM-DD HH24:MI:SS')
([DATE_TIME] < (to_date(#prompt('End_Date')#, 'YYYY-MM-DD HH24:MI:SS') -30))

You are a life saver!!

Title: Re: Framework Manager 10.2.1- Get Only the Last 30 days (NONE-CUBE)
Post by: MFGF on 22 Apr 2014 02:55:34 AM
Quote from: gosoccer on 21 Apr 2014 12:26:32 PM
Thanks so much! Your code did the trick. I would love t know how to do the same using "Filter Expression"
Here is what I have but end up getting errors. Didn't know what to have the below to work without the
prompt requirements.

([DATE_TIME] >= to_date(#prompt('Begin_Date')#, 'YYYY-MM-DD HH24:MI:SS')
([DATE_TIME] < (to_date(#prompt('End_Date')#, 'YYYY-MM-DD HH24:MI:SS') -30))

You are a life saver!!

Hi,

Sorry - I'm not following. I gave you a filter expression already?? What part doesn't work?

The code you included above contains prompt macros - do you need to prompt for a date?

MF.
Title: Re: Framework Manager 10.2.1- Get Only the Last 30 days (NONE-CUBE)
Post by: gosoccer on 22 Apr 2014 06:39:50 AM
NO need for prompt macros. Thank you for your time. It is working perfectly.