If somebody needs the age function the following answer might help:
Q:
Where is the AGE() function mentioned in the documentation?
A:
AGE() is depreciated since Appway 5.1.1.c and is only available in Appway 5.2 and 5.3 if the compatibilty mode has been activated.
Possible implementation for an AGE() function:
Function AGE(Date $date) : Integer Begin
Date $today := TODAY();
//special case: date is in the future
If $today.before($date) Then
Return 0;
End
// get difference in years, months and days
Integer $years := DATEFIELD($today, 'y') - DATEFIELD($date, 'y');
Integer $months := DATEFIELD($today, 'M') - DATEFIELD($date, 'M');
Integer $days := DATEFIELD($today, 'd') - DATEFIELD($date, 'd');
// Return age
If $months > 0 Then
Return $years;
ElseIf $months < 0 Then
Return $years - 1;
ElseIf $days > 0 Then
Return $years;
ElseIf $days < 0 Then
Return $years - 1;
Else
Return $years;
End
End
Q:
Where is the AGE() function mentioned in the documentation?
A:
AGE() is depreciated since Appway 5.1.1.c and is only available in Appway 5.2 and 5.3 if the compatibilty mode has been activated.
Possible implementation for an AGE() function:
Function AGE(Date $date) : Integer Begin
Date $today := TODAY();
//special case: date is in the future
If $today.before($date) Then
Return 0;
End
// get difference in years, months and days
Integer $years := DATEFIELD($today, 'y') - DATEFIELD($date, 'y');
Integer $months := DATEFIELD($today, 'M') - DATEFIELD($date, 'M');
Integer $days := DATEFIELD($today, 'd') - DATEFIELD($date, 'd');
// Return age
If $months > 0 Then
Return $years;
ElseIf $months < 0 Then
Return $years - 1;
ElseIf $days > 0 Then
Return $years;
ElseIf $days < 0 Then
Return $years - 1;
Else
Return $years;
End
End
Thanks for the answer Ste!