Hello all. If you’ve reached this far, please congratulate yourself on your level of commitment to learn a new skill. This attitude will go along way in you becoming a successful professional. So without any further delay lets go further with the series ‘Audit Command Language Tutorials for Beginners’. We are currently at the stage where we are discussing the character functions in ACL Audit Command Language.
In the post we are looking at the Last function. The Last function is a modification of the Sub/Substr function. This function is used in a specific case where it is required to extract a section of a string starting from the end. of course, this can be leveraged in combination with other functions, but still it is a function very helpful in a bind. For example, you may want to extract the value of year from a ‘date’ field. In such a case the last 4 characters most likely would yield the year.
Syntax: LAST(string, length)
Example in a script to create a new field using Last Function
DELETE FIELD TEST_Field OK
DEFINE FIELD TEST_Field COMPUTED AS
Example in a workspace to create a new field using Last Function
The result from both the above applications of this function would return the last character from column ‘Product Class’ into column ‘Test_Field’. The result would be as seen in the screenshot given below:
This function adds another dimension in your approach to transforming raw data files for any project. Such requirement may not be very pressing and there may even be other ways to get the same result. But why struggle when you have a simple method. At this point we expect you would be trying out these functions in your actual projects. Please see the function in action in the video 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.