Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I pass datadate through add command 1

Status
Not open for further replies.

krpurcel

IS-IT--Management
Dec 1, 2003
77
US
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?

Thanks!
 
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()}.

-LB
 
Lbass,

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.

Thanks very much for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top