I have a report where I want the end date to be the previous day. When doing this in Crystal's record selection I tell it datadate-1. How can I pass datadate-1 in an add command so I don't need to use Crystal's record selection?
I'm not sure whether there is a standard solution for all datasources. You could try sysdate--but I think that's a datetime and you would have to truncate it. Other solutions might depend upon your datasource, for example, for Oracle, you could use {fn curdate()}.
Thanks as always. I am indeed working on Oracle. Sorry for omitting that in the original post. Working off your suggestion we found the following which works well for limiting the record dates through add command.
FOR YESTERDAY:
"INCIDENTSM1"."OPEN_TIME" between new_time(TRUNC(current_date-1),'CST','GMT') and new_time(TRUNC(current_date),'CST','GMT')
FOR MONTH:
"INCIDENTSM1"."OPEN_TIME" between new_time(TRUNC(current_date, 'MM'),'CST','GMT') and new_time(TRUNC(current_date),'CST','GMT')
FOR YEAR:
"INCIDENTSM1"."OPEN_TIME" between new_time(TRUNC(current_date, 'YYYY'),'CST','GMT') and new_time(TRUNC(current_date),'CST','GMT')
As you pointed out in your post, SYSDATE is interchangable with current_date in this instance.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.