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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display Quarter Period Date

Status
Not open for further replies.

idehen

Technical User
Oct 26, 2004
92
0
0
GB
Hi,

I am using Crystal 2008 and am trying to display the actual dates used in my record selection. I have a formula used in the record selection run for quarter period as:

Formula:
If currentdate in Calendar1stQtr
Then {CLIENT.VALUATION_DATE} in date(DateAdd('m',-3,Date(Year(CurrentDate),01,01)))
to Date(Year(CurrentDate)-1,12,31)
Else
If currentdate in Calendar2ndQtr
Then {CLIENT.VALUATION_DATE} in Calendar1stQtr
Else
If currentdate in Calendar3rdQtr
Then {CLIENT.VALUATION_DATE} in Calendar2ndQtr
else
If currentdate in Calendar4thqtr
then {CLIENT.VALUATION_DATE} in Calendar3rdqtr

Now i want to be able to display the {From Date} and {To Date} based on the above record selection.

Basically i have a header title in the report that reads: Client information with Data: {From Date} to {To Date}.
can anyone help please.

Thanks
 
Create formula

@StartDate

If currentdate in Calendar1stQtr
Then minimum(Calendar1stQtr)
Else
If currentdate in Calendar2ndQtr
Then minimum(Calendar2ndQtr)
Else
If currentdate in Calendar3rdQtr
Then minimum(Calendar3rdQtr)
Else
If currentdate in Calendar4thqtr
Then minimum(Calendar4thQtr)

Repeat for @Enddate using Maximum

Ian
 
Thanks for that Ian.

problem however is that should the currentdate be the 1st of a new quarter, i want the from and to date to show previous quarter as this is what the record selection is picking up.

Example, if current date is 01/04/2012, your formula will be showing the heading as 01/04/2012 to 30/06/2012. rather this should show as 01/01/2012 to 31/03/2012.

I have tweaked your formula to show as:

@StartDate

* If currentdate in Calendar1stQtr
Then minimum(Calendar1stQtr)
Else *
If currentdate in Calendar2ndQtr
Then minimum(Calendar1stQtr)
Else
If currentdate in Calendar3rdQtr
Then minimum(Calendar2ndQtr)
Else
If currentdate in Calendar4thqtr
Then minimum(Calendar3rdQtr)

Repeat for @Enddate using Maximum

------------------------

However, i am stuck on how to display the 4th quarter 01/10/2012 to 31/12/2012 in the beginning of a New Year 01/01/2013.

That why i have marked the * as above for further review if you can assist.

Much appreciated.


 
Did not spot that refinement

This should work

If currentdate in Calendar1stQtr
Then dateadd("m", -3, minimum(Calendar1stQtr)) else ...

Ian
 
Fantastic!

Worked perfect.

Many thanks Ian.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top