Quote:By the way, this type of coding examples is much needed, especially the very common ones. By the way how would you calculate age.
var vYears as Int
var vMonths as Int
var vDays as Int
var vBirthdate as date = Birthdate
var VAge as string
vDays = @date - vBirthdate
vYears = vDays/365.25
vMonths = vDays/30
If vDays >= 365 then
{
vAge = @str (vYears) + " Years"
If @Int (vYears) = 1 then
vAge = @Replace (vAge, "Years", "Year")
}
Else if vDays >= 30 and vDays < 365 then
{
vAge = @str (vMonths) + " Months"
If @Int (vMonths) = 1 then
vAge = @Replace (vAge, "Months", "Month")
}
Else if vDays < 30 then
{
vAge = @str (vDays) + " Days"
If @Int (vDays) = 1 then
vAge = @Replace (vAge, "Days", "Day")
}
Age = Vage