Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Prompt for Quarter with Date Range Post Reply Post New Topic
Author Message
jrs1234
Newbie
Newbie


Joined: 02 Mar 2009
Location: United States
Online Status: Offline
Posts: 37
Quote jrs1234 Replybullet Topic: Prompt for Quarter with Date Range
     Posted: 13 Mar 2009 at 11:24am
Hi!
 
I have a report that has an Admitdate (format mm/dd/yyyy) from the database.
 
I need to create a "quarter" prompt that has 4 possible entries: 1st, 2nd, 3rd, 4th.
 
These need to correspond with the admit date falling into one of these entries. And I only want the admitdates for the current year/quarter..
 
 
1st = jan - march
2nd = april - june
3rd = july - sept
4th = oct - dec
 
I am lost as to where to begin .. any help would be greatly appreciated!
Thanks
JennConfused
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Mar 2009 at 2:06pm
Create a number parameter called Quarter with min and max values of 1 and 4.
Create a formula field from your date field as Quarter:
Datepart("q", {table.datefield})
 
Point your parameter to = this formula
 
In your select statement add in a way to minimize the date range to a the last year for all data:
datediff("d", {table.datefield},currentdate)<365
 
Keep in mind that this may throw something off because you will possible have items that are say first Quarter last year and first Q this year which will be both indicated as first quarter and get pulled into the report.
Or give me the definition of what you mean for by only wanting this for the current year and I may be able to help clean up the above statement to work better for that.
You will have to decide how you want to cut your data off to avoid this or include a year int he values somehow to avoid it.
Hope this helps as a start.


Edited by DBlank - 13 Mar 2009 at 2:13pm
IP IP Logged
jrs1234
Newbie
Newbie


Joined: 02 Mar 2009
Location: United States
Online Status: Offline
Posts: 37
Quote jrs1234 Replybullet Posted: 13 Mar 2009 at 2:29pm
Thanks sooooo much !!!! That worked .. so much appreciated !!!Clap
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