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

"ToText" for Quarterly date range

Status
Not open for further replies.

JoyCR9

MIS
Jan 13, 2004
70
CA
In CRYSTAL REPORTS 9, I am using the following formula (@lastquarter) to select records based on true:
f Month(Today) >=1 and Month(Today)<=3 then
(Year({SERVICE_CALL.CREATE_DT}) = Year(Today)-1 AND Month({SERVICE_CALL.CREATE_DT}) in [10,11,12])
Else
If Month(Today) >=4 and Month(Today)<=6 then
(Year({SERVICE_CALL.CREATE_DT}) = Year(Today) AND Month({SERVICE_CALL.CREATE_DT}) in [1,2,3])
Else
If Month(Today) >=7 and Month(Today)<=9 then
(Year({SERVICE_CALL.CREATE_DT}) = Year(Today) AND Month({SERVICE_CALL.CREATE_DT}) in [4,5,6])
Else
If Month(Today) >=10 and Month(Today)<=12 then
(Year({SERVICE_CALL.CREATE_DT}) = Year(Today) AND Month({SERVICE_CALL.CREATE_DT}) in [7,8,9])

How do I get the title to print:
"October 1, 2004 to December 31, 2004"

My standard:
Totext (minimum({SERVICE_CALL.CREATE_DT}) to maximum..... only prints the actual date of the service call create date which may not necessarily fall on Oct 1 - Dec 31.
 
Try:

Totext(minimum(year({SERVICE_CALL.CREATE_DT}),month({SERVICE_CALL.CREATE_DT}),1)...

Which could be wrong also if you don't at least have some data for the month.

Otherwise you'd use something akin to your current formula.

If Month(Today) >=1 and Month(Today)<=3 then
totext(cdate(Year(Today)-1),10,1))
Else
If Month(Today) >=4 and Month(Today)<=6 then
totext(cdate(Year(Today),1,1)
else
...you get the idea

-k
 
Thanks for pointing me in the right direction. I went with:

If Month(Today) >=1 and Month(Today)<=3 then
totext(cdate(Year(Today)-1,10,1))+ 'to' + totext(cdate(Year(Today)-1,12,31))
Else
If Month(Today) >=4 and Month(Today)<=6 then
totext(cdate(Year(Today),1,1))+ 'to' + totext(cdate(Year(Today),3,31))
Else
If Month(Today) >=7 and Month(Today)<=9 then
Totext(cdate(Year(Today),4,1))+ 'to' + totext(cdate(Year(Today),6,30))
Else
If Month(Today) >=10 and Month(Today)<=12 then
Totext(cdate(Year(Today),07,1))+ 'to' + totext(cdate(Year(Today),09,30))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top