COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: pooja on 06 Nov 2008 07:46:27 AM

Title: annulay
Post by: pooja on 06 Nov 2008 07:46:27 AM
i am trying to display the statement HEADER with Monthly or Quaterly from same report

if i have date range greate than 90 days then should display Annualy if not then Quaterly

till now  I am able to get only Annualy.......and this is displaying on Header part
thank you in Advance...

Pj
Title: Re: annulay
Post by: blom0344 on 06 Nov 2008 07:54:46 AM
What is the expression that you are using now. We can take it from there if you post the code..
Title: Re: annulay
Post by: pooja on 06 Nov 2008 07:59:40 AM
_add_days([firstMO],60)

i make the condition like 90 days from begining date
Title: Re: annulay
Post by: pooja on 06 Nov 2008 08:19:05 AM
i mean I have a function on prompt page begindate and enddate

the results between these days over 90days then yearly
if not then monthly...??

thank you

pj
Title: Re: annulay
Post by: pooja on 06 Nov 2008 09:21:25 AM
([[transactions].[DTMEFFECTIVEDATE]=(_add_days(?promptBeginDate?,60))) THEN
('quateerly')
else
('yearly')


??????
Title: Re: annulay
Post by: pooja on 06 Nov 2008 10:53:02 AM
???
???
???
??
thank you

pj
Title: Re: annulay
Post by: DanSev on 06 Nov 2008 11:50:03 AM
I think I understand the question:

You are filtering based on a date range. If the difference between the dates selected is greater than 90 days you want to display 'Annual Report' in the report's header. If it is less then 'Quarterly Report'.

The best way to go about this is using two seperate parameters in the date range, and not a single date prompt with range turned on. Have two seperate date prompts, each with its owner parameters. You'll need to change your filters ( [Time Value] >= ?BeginningDate? and a seperate filter for [Time Value] <= ?EndDate? -- thus including the date selected and not just days in between).

Then create a query that has three data items - one is the BegginingDate, one is the enddate (eg having ?EndDate? as its contents) The third has _days_between([EndDate],[BeginningDate]).  Set the data properties for the report page to that Query, and select the Days Between as a property.

In a report expression you can now use the following logic: if([Query1].[Days Between] > 90) then ('Annual')
else ('Quarterly').

I've included a sample report that doesn't rely on a specific package to run, just set its package to one of yours to see this in action.
Title: Re: annulay
Post by: pooja on 06 Nov 2008 12:57:24 PM
DanSev
thnk  you so much.....
i appreciate.....i this is not much difficult one.....but u gave me soem idea....
i thank you again


pj