Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Some Strange Date Formulas Post Reply Post New Topic
Author Message
bradlee27514
Newbie
Newbie


Joined: 24 Jun 2009
Location: United States
Online Status: Offline
Posts: 20
Quote bradlee27514 Replybullet Topic: Some Strange Date Formulas
     Posted: 30 Mar 2010 at 8:28am
I'm sure this is possible, but can't seem to figure the coding out.

I have a report I want to run any given day and select data based on a start date and an end date.

I want the start date to be day 1 of 3 months ago.
I want the end date to be the last day of the last month.

For example,
If the report was run on April 26th
start date = 1/1/2010
end date = 3/31/10

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 30 Mar 2010 at 8:44am

{table.date} in dateserial(year(currentdate),(month(currentdate))-3,1) to dateserial(year(currentdate),month(currentdate),1-1)

IP IP Logged
bradlee27514
Newbie
Newbie


Joined: 24 Jun 2009
Location: United States
Online Status: Offline
Posts: 20
Quote bradlee27514 Replybullet Posted: 30 Mar 2010 at 8:47am
this would go in a formula?  im not  reading the dates from a db, they are manipulations off current date.   going to use in the selection criteria.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 30 Mar 2010 at 8:55am

It goes in the select expert.

Replace the {table.date} with the field you are evaluating in the DB (your row date that you want to include). The rest of the statmetn is based off of todays date
IP IP Logged
bradlee27514
Newbie
Newbie


Joined: 24 Jun 2009
Location: United States
Online Status: Offline
Posts: 20
Quote bradlee27514 Replybullet Posted: 30 Mar 2010 at 9:37am
oh i see, so if i wanted to say put the end date in a formula to output elsewhere, i would entere "dateserial(year(currentdate),month(currentdate),1-1)"

thanks!  im just so used to using formulas and then sticking the logic in the select expert referencing the formulas.  thanks!!!
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum