Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2016 : Technical Questions
Message Icon Topic: Age Calculation Formula Post Reply Post New Topic
Author Message
NCGOV
Newbie
Newbie
Avatar

Joined: 04 Oct 2016
Online Status: Offline
Posts: 23
Quote NCGOV Replybullet Topic: Age Calculation Formula
    Posted: 19 Dec 2019 at 7:51am
I need an age calculation formula that will look for blank DOB fields and display nothing for the age field. The formula I have excludes all of the name if the DOB is blank.

Age Formula - INT((CurrentDate-{name.dob})/365.25)


Entire Name Formula -
local stringvar ls := trim({name.lastname}) & " " & trim({name.suffix});
local stringvar fm := trim({name.firstname}) & " " & trim({name.middlename});
local stringvar fn;
If length(trim((ls))) > 0 and length(trim((fm))) > 0 then
    fn := trim(ls) & ", " & trim(fm)
else
    fn := trim(ls) & trim(fm);

If length({name.race}) < 1  then
    local stringvar rc := "-"
else rc := {name.race} & "/";

If length({name.sex}) < 1  then
    local stringvar sx := " - "
else sx := {name.sex};

fn & " - "& trim (rc) & trim (sx) & " "& " " & trim ({name.age})
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1514
Quote kevlray Replybullet Posted: 19 Dec 2019 at 10:26am
Many years ago Ken Hamady creates a formula that I consider a very good on.  Check out his web site. http://www.kenhamady.com
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.