Crystal Report Query – Birthday Formula

10 pts.
Tags:
Birthdays
Crystal Reports
Crystal Reports formulas
Formula Workshop
I currently run a report that returns customer birthdays within given date perameters. I use the following formula to calculate birthdays: Date(year(CurrentDate),month({driver_details.drd_dob}), day({driver_details.drd_dob}) ) I then set parameter values to return birthdays within a certain range (e.g. start 22/12/2008 end 28/12/2008). This has been working perfectly until I try to go into 2009, (e.g. the report for 29/12/2008 to 04/01/2009) only returns birthdays up to 31st Dec. Do you have any suggestions as to how I could modify my current formula or make a new one that will give me birthdays into next year? Any advice you have would be much appreciated!

Answer Wiki

Thanks. We'll let you know when a new response is added.

What I would do is create an if statement that adds a year to the year if the date is before the current date. For example
if Date(year(CurrentDate),month({driver_details.drd_dob}), day({driver_details.drd_dob})) >= Date() then
Date(year(CurrentDate),month({driver_details.drd_dob}), day({driver_details.drd_dob}))
else
Date(year(CurrentDate)+1,month({driver_details.drd_dob}), day({driver_details.drd_dob}))
end if

Hope this helps,
Dustin

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following