Link to home
Start Free TrialLog in
Avatar of Blowfelt82
Blowfelt82

asked on

Get date range prompt date parts in Cognos.

I have a prompt page in my Cognos report that only has a date range prompt, this date range is assigned to a varible which I am writing to a label in my actual report. This date range is formatted as...

'Between 6 Sep 2011 and 9 Sep 2011'

This is fine, but what I need is to be able to get the start date i.e. '6 Sep 2011' and '9 Sep 2011' as seperate variables. Do you have any ideas?
Avatar of SNeupane
SNeupane
Flag of United States of America image

Easiest method is, instead of a date range, use two date prompts:
StartDate
EndDate
Use the two date prompts in filter using between ?StartDate? and ?EndDate?
Then you can format them in your report accordingly.
Avatar of Blowfelt82
Blowfelt82

ASKER

Yeah I thought along these lines, but I was hoping that there would be another way which kept the existing prompt format. This change will have to be applied across a number of reports, so would like a change that wont change the apperance of the reports - my users are very fussy about changes like this. Can the solution I described be acheived... it doesnt matter how complex (within reason) but I really dont want to change the appearance of exisiting forms.
Where does the 'between ... and ...' format come from.
How are you filtering the date in your report with in_range?
When you have in range, you only have one variable to filter the report date.
Since you need 2 variables for start and end, you have to replace that in range filter in the report with between ... and filter to include both prompt variables.
Check the query for report and look at the filters.
I am testing this using a very basic report, all I have done is added a date prompt to the report prompt page, set its attribute to range and set the parameter attribute to 'test'. Then in the report I have added a text item, set the source type to report expression and then used 'ParamDisplayValue('test') to output the date.

This is just a test, all I want to do is get the date parts for both display at the moment.
ASKER CERTIFIED SOLUTION
Avatar of SNeupane
SNeupane
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Do not use 'range' for those date prompts.
My comment #36497132 should resolve the issue.
I've tested it and works fine.
Sorry for the late response.