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

Using Case Expression

Status
Not open for further replies.

EMVIC

MIS
Jul 29, 2006
12
GB
Hi I’m very new to Crystal reports and have been faced with this problem. The script below is as I would normally define it in SQL to restrict the amount of data required for my report using case statement
Case
when (enrolment_date between 'April 1, 2003' and 'March 31,2004')then 'Y03'
when (enrolment _date between 'April 1, 2004' and 'March 31,2005')then 'Y04'
else 'other'
end as Period
from....
where enrolment.enrolment _date between ‘2003-04-01’ and ‘2004-03-31’
…….
…….
How can I accomplish this statement using crystal reports formula? I intend to have a column named Period with the enrolment year grouped as stated above ie Y03, Y04. Can someone pls assist me
 
Create a formula of:

if {table.enrolment_date} in cdate(2003,4,1) to cdate(2004,3,31) then
"Y03"
else
if {table.enrolment_date} in cdate(2004,4,1) to cdate(2005,3,31) then
"Y04"
else 'other'

Now group by this formula within the report.

-k
 
thanks for your assistance. it worked
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top