ACL Date Function – Age() Function




Hello guys, we are back. I hope we are feeling proud of ourselves. Give yourself a pat on the back for sticking with the program. Needless to say, we have accomplished quite a bit very quickly. This series of posts, ‘Audit Command Language Tutorial for Beginners’ has turned out to be quite a journey for our team as well. This journey is extremely rewarding for us in ways we did not imagine.

Let us keep on going with the discussion on the next functions in the series of posts for Audit Command Language, date functions.  In this post we will be discussing the  Age function. This function is used to extract the difference between two date values. These values can be provided directly within the function itself or two comparing date fields. This function returns a numeric value.

Syntax: AGE(Date1,DATE2)

Example in a script to create a new field using Age Function

OPEN EMPMAST
DELETE FIELD TEST_Field OK
DEFINE FIELD TEST_Field COMPUTED AS
AGE(HireDate,`19820101`)

Example in a workspace to create a new field using Age Function

TEST_Field Computed
AGE(HireDate,`19820101`)

See below the result of the Age function.

The Age function is easy enough function to implement. It can be seen in the screenshot above how the difference in the date values (provided in the script or workspace) is shown in the new column ‘Test_Field’. It seems most employees are hired after the threshold date ’01/01/1982′ provided in the function. This is indicated by the ‘-‘ sign. Essentially, the calculation is working as ‘Date2 – Date1’. The point to note however, is that this function provides a numeric value. Check out the video demo below:

Please keep practicing and feel free to reach out to us with your valuable feedback and comments. Please go through the website to review ACL script examples and ACL script commands sign up for our newsletter, so that we may keep you posted on the latest activity on our website and Youtube channel.