ACL Character Function – Length() Function

Hello again. It would seem at this point that we are making fine progress in learning the Audit Command Language. So far we have covered over 10 character functions. To give a context this is the extent of what you may learn while being in your new job as a fresh data analyst in the first two months (fluently at least). But there is still some way to go in the series ‘Audit Command Language tutorials for Beginners’, so we must keep on pushing through.

In this post we are going to detail the Length function. The goal of the function is pretty self explanatory. It returns the length of the character string in field and returns a new computed field. In most Audit Command Language scripts, this function is used to create a flag of sorts to test whether or not the length of a field is consistent. For instance, typically values in fields like ‘Business Unit’, ‘Account Number’, ‘Customer ID’ are more often than not defined in a scheme which has a fixed length. This function serves as a check to ensure data integrity in such cases.

Syntax: Length(String)

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



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


TEST_Field Computed

Both the above statements return the result where the numbers in the column ‘Product Number’ are returned as Numeric values in the new column ‘Test_Field’ shown in the screenshot below:


As shown in the above example, we can obtain the length of the field Dept Code and as discussed earlier, we expect that it would be consistent at ‘2’ characters. If the same function would be applied to the field ‘ Dept. Name’ then we would see varied length. We will discuss in a later post how we can use this function as a flag to compute a new field. Please keep practicing and share your experience.You can see a demo of the function.

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.