Print Page | Close Window

Currentdate

Printed From: Crystal Reports Book
Category: Crystal Reports .NET 2003
Forum Name: Tips and Tricks
Forum Discription: Have you learned some great tricks to share with the group? Post them here!
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=12509
Printed Date: 20 Apr 2024 at 2:27am


Topic: Currentdate
Posted By: elton3d
Subject: Currentdate
Date Posted: 04 Mar 2011 at 10:37am
Hi, I wonder if somone could help?

I am trying to use the select expert to select the next coming saturday and sunday only on the report.

I have tried a mixture of things but cant get it to work...


{date} = today + 1 and {date} = today + 2 which does not work.

I cant use an actual date as the report will need to be run every friday to retrieve sat and sun.

Any help would be great please.Smile



Replies:
Posted By: comatt1
Date Posted: 25 May 2011 at 5:14am
dateadd('d',1,CurrentDate)


Posted By: rocketgirl
Date Posted: 07 Jun 2011 at 12:57am
Hi
Hope you found an answer by now but if not,
I have used varying combinations of 'day of week' and 'current date' to set recurring reports to run on any day of a week but for the same period of days
 
for example {Date} = CurrentDate - Dayofweek(CurrentDate)
will always give you info for last Saturday
and  {Date} = CurrentDate - Dayofweek(CurrentDate)-1 will always give you data for last Friday 
regardless of what day of the week you pysically run your report
 
so {Date} = CurrentDate - Dayofweek(CurrentDate)+6 should give you this coming Saturday
 
HTH


Posted By: Alexander
Date Posted: 11 Jan 2012 at 6:50pm
[QUOTE=rocketgirl]Hi
Hope you found an answer by now but if not,
I have used varying combinations of 'day of week' and 'current date' to set recurring reports to run on any day of a week but for the same period of days
 
for example {Date} = CurrentDate - Dayofweek(CurrentDate)
will always give you info for last Saturday
and  {Date} = CurrentDate - Dayofweek(CurrentDate)-1 will always give you data for last Friday 
regardless of what day of the week you pysically run your report
 
so {Date} = CurrentDate - Dayofweek(CurrentDate)+6 should give you this coming Saturday
 
HTH
[/QU
 
Hi,
In a crosstab monthwise i am giving date range let say from oct-2011 to till date i:e 12 jan-2012 so it is taking full month of oct, nov, dec & 12 days for current month.
 
what i want if today is 12th so it should take 1-12 of everymonth.
 
Can you please help me on this!
 
Regads
Alex


Posted By: mrtj
Date Posted: 02 Jan 2014 at 6:28am
here works a formula to always return a date that happens to be a Thursday. If its sunday thru wednesday the first part of the if statement runs, if its fri or sat, the else part runs.

shared Datevar Thur;

if Dayofweek(CurrentDate)<=5 then
Thur:= CurrentDate - Dayofweek(CurrentDate)+5 else

Thur:= CurrentDate - Dayofweek(CurrentDate)+12;
//when the date is 1/3/14 then dayofweek is 6. 1/3/14 minus 6+12 same as 1/3/14+6 which is 1/9/14
//when the date is 1/4/14 then dayofweek is 7. 1/4/14 minus 7+12 same as 1/4/14+5 which is 1/9/14




Print Page | Close Window