Question
· May 9

Age Calculator in BPL

Hello All,

No matter what I try in Business Process Logic (BPL), I am unable to calculate the patient's age in days or years.

Has anyone ever built logic in a Business Process (BPL) to calculate a person's age in days?

Thank you!

Product version: IRIS 2023.1
Discussion (4)2
Log in or sign up to continue

I'd implement a custom function, create a class like:

Class Community.CustomFunctions Extends Ens.Rule.FunctionSet
{

/// Returns Age in years from DOB in YYYYMMDD format
ClassMethod GetAge(DateOfBirth As %String) As %Integer
{
    Quit (($H-$ZDATETIMEH(DateOfBirth,8)) \ 365.25)
}
/// Returns Age in days from DOB in YYYYMMDD format
ClassMethod GetAgeDays(DateOfBirth As %String) As %Integer
{
	Quit ($H-$ZDATETIMEH(DateOfBirth,8))
}

}

Then from any Rule or DTL transformation you can use these two function as any other built in function.

Make sure DOB is not null ("") before calling the function.