Reply To: does anyone have a tps to calcuate age

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf does anyone have a tps to calcuate age Reply To: does anyone have a tps to calcuate age

#58184
Rentian Huang
Participant

    Nancy,

    Assuming we have 365 days a year, this should give you the age. It’s an Xltp.

    Code:

    proc xltGetAge {} {
       upvar xlateId       xlateId
     xlateInList   xlateInList
     xlateInTypes  xlateInTypes
     xlateInVals   xlateInVals
     xlateOutList  xlateOutList
     xlateOutTypes xlateOutTypes
     xlateOutVals  xlateOutVals

    set dob [lindex $xlateInVals 0]
    set age [expr {([getclock] – [clock scan $dob])/86400/365}]
    set xlateOutVals $age
    }

    Hope this helps,

    Sam   8)