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

How to group report on Age 1

Status
Not open for further replies.

gtb12314

Programmer
Jan 7, 2008
41
US
Hi Everyone,

In my report I want to include a group based on employee age,I mean group those employees who are already turned 50 years of age OR
going to turn 50 years of age in this calendar year
OR greather than 50 years of age.

And in my report I have a datetime database field called Birthdate.

And according to my standars I cannot use CurrentDate function.

Any suggestion is greatly appreciated.


Thanks in advance
 
I am unclear what you want your groups to be. Are you saying you want one group with all people age 50 (sometime this year) and above and another for people under 50?

Why can't you use currentdate? What alternative are you considering?

-LB
 
Hi,

I want only one group in the report with all people age 50 (sometime this year, but I don't want to hard code the year, the year should be dynamic) and above . Alternative to currentdate is use Datadate.

Thank You
 
You don't need a group if you are only going to show one age group. Use a record selection formula like this:

year({table.birthdate}) < year(datadate)-49

-LB
 
If you wanted a group made for this, then create a formula.
---------------------------------
@AgeGroup
---------------------------------
stringvar AgeGroup;
numbervar AgeYears;

//finding the number of years.
ageyears:= year(currentdate) - year (birthdate);

// Labelling the age group
if AgeYears > 49 then ( AgeGroup:= "50 Plus")
else (AgeGroup :="Under 50");
AgeGroup
---------------------------------

Then Group by @AgeGroup if you wish.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top