Hi Vic,
Attached is a report spec, you may need to connect it to a different package in order to get it to run. However you can also review/copy/paste the expressions. If you get an error opening it in Report Studio, you may want to edit the version numbers in the first line to match version numbers that you see in specs. in your environment; I'm pretty sure I did not use anything recently introduced.
I used a UI - edit box- Gregorian calendar named the parameter from_date
The start_date column has the expression:
case when ?from_date? = current_date
then _add_years(?from_date? , -15 )
else ?from_date?
end
Some of the other columns show how to do it with macros values (evaluated at query prep time).
I hope this helps.
//Henk
------------------------------
HENK CAZEMIER
------------------------------
Original Message:
Sent: Mon May 06, 2019 12:26 PM
From: Vic Nicholls
Subject: current_date and filter/parameter check
Version 11.0.12.
Part of spec? XML? and how would I do part of the spec?
On the prompt page, I have 2 date prompts called To Date and From Date. Both are UI edit box, calendar type Gregorian. When clicking on the box, a calendar comes up and I choose the calendar. From outputing the parameters on the page, May 6, 2019 is what shows for both items.
I've tried the current_date which is a constant to compare to.
Basically I want to say if the parameters From Date and To Date = today's date, make the from date add_years - 15.
Thanks.
------------------------------
Vic Nicholls
Original Message:
Sent: Mon May 06, 2019 10:23 AM
From: HENK CAZEMIER
Subject: current_date and filter/parameter check
Hi Vic,
Which version are you using and which product ?
If you're using Report Studio, could you attach that part of the specification?
What are the values that are entered in the edit fields boxes?
Have you tried using a date-prompt ?
//Henk
------------------------------
HENK CAZEMIER
Original Message:
Sent: Mon May 06, 2019 08:05 AM
From: Vic Nicholls
Subject: current_date and filter/parameter check
Hi,
I want to have a filter that does the following:
compare a edit box prompt (called "To Date") to the current_date and
compare a edit box prompt (called "From Date") to the current_date
and if they match, make the To Date be the current date - 15 years.
I believe making the To Date would be "To Date" = add_years (To_Date, -15) but for whatever reason, I can't seem to get the format of the To Date and current_date correct to compare them.
Any ideas? When I look at the To Date param it says May 6, 2019 and the current_date says May 6, 2019.
------------------------------
Vic Nicholls
------------------------------
#CognosAnalyticswithWatson