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!

Select records From Where 1

Status
Not open for further replies.

Evil8

MIS
Mar 3, 2006
313
0
0
US
I need to report spouse age on my report.

I have a table named tbl_ClDependant that has fields BirhtDate (Yes I know its spelled wrong, I didn't do it) and Relationship. Values for the Relationship feild are SPOU for spouse and anything else equals a child.

I also have a working age calculation formula I named Dep Age:

(if Month ({tbl_ClDependant.BirhtDate}) < Month (CurrentDate) or
(Month ({tbl_ClDependant.BirhtDate}) = Month (CurrentDate) and
Day ({tbl_ClDependant.BirhtDate}) <= Day (CurrentDate))
then Year (CurrentDate) - Year ({tbl_ClDependant.BirhtDate})
else (Year(CurrentDate) - Year({tbl_ClDependant.BirhtDate}))-1)

So I would need to Select Dep Age where tbl_ClDependant.Relationship = "SPOU" but I can't seem to get it to work.

Thanks
 
if {tbl_ClDependant.Relationship} = "SPOU" then
{@Dep_Age}

-LB
 
Here's a slighty different Age calculation formula:

//Age in Years
NumberVar DoBVar := IIF((100 * MONTH(CURRENTDATE) + DAY(CURRENTDATE)) < (100 * MONTH({person.birthdate}) + DAY({person.birthdate})), 1, 0);
NumberVar YrsVar := DATEDIFF("yyyy",{person.birthdate},CURRENTDATE) - DobVar;

Other than that, when you say "I would need to Select Dep Age where tbl_ClDependant.Relationship = "SPOU" " what do you mean?

Are you trying to limit the report to just spouses? The age formula would work for every record in the table. Do you want to show all records, but only include an age if the person is a spouse?

~Kurt

 
Sorry guys I'm very new at Crystal Reports and this legacy database really bites.

lBass - Where does that if/then statement go?

rhinok -

I only need the ages of the spouses on the report. Report Fields (for a specific Company Name) include:
Employee(EE)
Marital Status
EE Gender
EE DoB
EE Age(formulated from EE DoB)
Spouse DoB
Spouse Age
# of Children

 
Where are you displaying the spouse's age, i.e., in what report section? I'm guessing that you are displaying it in a group that is based on {table.employee}. Then place the formula I suggested in the detail section and insert a maximum on it at the employee group level. Then drag it into the employee group header (if that's where you are displaying this info).

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top