ACL Character Function – Between() Function

ACL Character Function – Lower() Function

The next two functions in the current series of posts in ‘Audit Command Language tutorials for Beginners’ are quite simple and basic. Its nice to learn some easy things once in a while to keep up the moral 🙂

So without any further delay, lets jump right into it. The first of these functions is the Lower function. The name of the function gives away its functionality (Its that simple). However, in the spirit of being thorough, this function is used to convert all characters of a string to lower case. It is hard to imagine any practical use of this function except for where conditional statements are being used for an exact match for strings.

Syntax: Lower(String)

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

lower-script

DELETE FIELD TEST_Field OK
DEFINE FIELD TEST_Field COMPUTED AS
Lower(First)

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

lower-workspace

TEST_Field Computed
Lower(First)

Both the above statements return the result where the new column ‘Test_Field’ has the first names all in small case as shown in the screenshot below:

lower-result

The above example illustrates the use of the function. The above example is one of the ways to use this function. Also check out the video below for a demo of the function.

In the next post we’ll cover the UPPER function. Give it try and please share your thoughts and challenges.

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.

.




 

ACL Character Function – Exclude() Function

Greetings and welcome to the latest post in the series ‘Audit Command Language Tutorial‘ for Beginners. The next few posts are going to be dedicated to character functions as discussed in the last post. Each of the following posts will explore a character function in detail with an example. So let’s dive straight in.

The first of these functions is the Exclude function. A very important function for data cleansing purposes. Every so often there are certain special characters that get included in certain key fields in data sets. In order to ensure correct analysis on these key fields, it is required that these special characters be excluded from the field in order to normalize/standardize the data.

Syntax: Exclude(Data Field or string ,<Characters to exclude>)

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

DELETE FIELD NEW_GENDER OK
DEFINE FIELD NEW_GENDER COMPUTED AS
Exclude(FIELD_1,’M’)

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

New_GENDER                                Computed
EXCLUDE(FIELD_1,’M’)

Results from either of the above methods would be that any instance of the character ‘M’ will be removed from any relevant values in the column ‘Field_1’ when creating the new column ‘New_Gender’.

This is an easy enough function to use and apply in any project. The only thing to do is to identify the appropriate instance for implementation. Check out the video for a demo of the function :

This post and the subsequent entries should provide for considerable inputs for you to start playing around with data formatting efforts in your own projects.

Please keep practicing and feel free to reach out to us with your valuable feedback and comments. Please go to 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.




Audit Command Language – Functions

Welcome to another post in the series ‘Audit Command Language Tutorial for Beginners’. At this point we have discussed two of the key aspects of the ACL tool; creation of scripts and workspaces. The next important piece of the puzzle is ‘Functions’. The remainder of this post is written assuming that the reader has some coding background only to follow along for the terminology.

Functions in any programming language are kind of stored procedures that come with the package to perform certain repetitive tasks. These tasks can be something like, extracting a section of a existing field, formatting data fields to be more presentable way or perhaps just to simply sum up two columns. There are a number of such routine tasks. The functionality of functions provides data analyst the ability to get to relevant data points faster.

Based on the most routinely required functionality, functions are broadly classified in the following three categories:

  1. Character Functions: As the name suggests, this category functions is used on character type data files i.e. imported as ASCII during data import in Audit Command Language software. There is often need for extracting certain sections in a field, or excluding/including/replacing certain characters from a data field and so on. These operations can only be performed on character data types. Some of the most commonly used functions are:
    • Exclude()
    • Include()
    • Replace()
    • Sub() or substring()
    • Alltrim()
    • last()
    • Value()
    • Match()
    • length()
    • string()
    • Split()
    • Upper()
    • Lower()
    • Between()
  2. Numeric Functions: Just like character functions, numeric functions are required to be integers i.e. imported as ‘Numeric’ data type into ACL. Some of the most commonly used numeric functions are:
    • Dec()
    • Round()
    • ABS()
    • INT()
    • Zoned()
    • Between()
  3. Date Functions: Dates are essentially numeric values stored in date formats. Since, the computation on dates are slightly different than regular numbers, there are a set of different functions to extract information from such fields like, current day, current month, day of the week, number of days between two dates and so on. The most regularly used date functions are:
    • CTOD()
    • CDOW()
    • CTOT()
    • DATE()
    • MONTH()
    • AGE()

These basic function types are briefly covered in the following three videos:

Character Functions

Numeric Functions

Date Functions

Besides the above mentioned categories there is another set of functions, leveraged solely for the purpose of data correction in case there are problems in the data file as discussed in the previous posts: data issues ‘split’ & ‘spill’. Most regularly summoned functions for such tasks are:

  1. Recoffset()
  2. Static

The goal of this post is to introduce the readers to functions that would be discussed in the upcoming posts. Each of the above mentioned functions would detailed with its own accompanying post with example and sample scripts that can be leveraged in your own projects.

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.



Audit Command Language – Scripts

Welcome to the latest post in the series ‘Audit Command Language Tutorial for Beginners’. At this point, it is our hope that you are able to successfully navigate the GUI of the ACL tool. If there are still any doubts, go through the video below for a walkthrough of the tool before reading on further.

In this post, we will be discussing how to set up and start scripting in your ACL projects. Audit Command Language scripts are fairly straightforward and easy to write as compared to other tools. In a backhanded fashion, on the simplicity also limits the functionality available in other tools in the market.

Creating a new script: Right click on the project folder in the ‘Project Navigator’ -> ‘New’ -> ‘Script’

script-1

Writing your first lines of script: Try writing the below script to create a new column ‘new_acct’ in the table ‘sample’.

OPEN SAMPLE

DELETE FIELD NEW_Gender OK
DEFINE FIELD NEW_Gender COMPUTED AS
ALLTRIM(Field_1)

After writing the script, press the ‘play’ button. If the script completes successfully, you would see the small green ‘check’ sign in the bottom right section of the tool.

If there is any error, there would a red dot next to the line with the error and a red cross at the bottom right corner of the tool. You may watch the video below for the same walk through.

Of course, there are a number of things that can be done via scripting in any tool and the same is true for Audit Command Language Scripts. Besides the creation of fields, there are functions (character, numeric, date), joins etc. and other commands for various other manipulations that can be performed on data sets. All these different aspects will be covered in separate posts so as to explore each in a detailed and comprehensively.

If you wish to be proactive in learning how to script in ACL, I would urge you to fiddle around with the ACL GUI. Any command that is performed using the GUI is logged in the logs. These can be check as each command is executed in the ‘log’ tab at the bottom of the project navigator. Select the command and the corresponding script would appear ‘Define’ window next to the project navigator. See image below.

These scripts can be used to build simple projects very quickly and allow for practice for beginners. So play around with the tool to learn and practice as much as you can for Audit Command Language Scripts.

Please keep practicing and feel free to reach out to us with your valuable feedback and comments. Please go to 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.

Audit Command Language – Workspaces

Welcome to ‘Audit Command Language Tutorial for Beginners’ series. Most seasoned analytics professionals often complain that there are better tools that ACL to perform analytics on data sets. In most scenarios, this is a fair complaint against the ACL tool. However, if there is one feature that sets ACL apart from others is the ‘Workspace’. The ‘Workspaces’ in ACL are kind of a short cut to scripting when required to create the new fields. Simply define the required fields in the ‘Workspace’, select the table and activate the ‘Work Space’. You can then simply add the new columns via scripting or the GUI.

Creating a Workspace

Simply right click in the ‘Project Navigator’ on the left of the program. Select New -> Workspace and rename the new Workspace appropriately.

work-space-step-1                   work-space-step-2

Scripting the Workspace

After creating the workspace, you need to write a script for the new column to be created in any existing table. Consider the sample script to create a new field ‘New_Gender’ from an existing field ‘Field_1’. The script in the work space would be

New_Gender                            Computed
alltrim(Field_1)

See below:

Activating the Workspace

Save the script in the workspace. Open the target table, right click on the workspace icon in the Project Navigator and click ‘Activate’. If you receive no pop-up, that implies the script in the workspace is correct and the new field is available to be added in the selected table. See image below

As you can see, the table ‘sample’ is selected the workspace is activated. Next, press ‘CTR + i’ to see the list of fields in the table. The newly created field would be present in that list.

To add a new column to the table using GUI, simply right-click on any column header in the table and select add column. Follow steps in the next windows and you’re done.

Going off the above example, imagine the possibilities of leveraging the same workspace to work on different tables. Essentially, the workspace is acting as complimentary scripts to the main scripts. It is for this reason, that in most script structures in ACL Audit Command Language, fields are not defined in the main body and certainly improves the performance of a project.

Audit Command Language – Data Issues

Welcome to the ‘Audit Command Language Tutorial for Beginners’. At this stage, we have discussed how to import delimited files and excel files into ACL projects to perform analytics. The next step is to perform checks to ensure that the data is imported correctly. There are two most common kinds of issues that are seen while importing data into any tool.

  1. Data Spill: This type of data issue causes the data to spill over into the next columns. This generally happens because there may be extra delimiters in some field (generally, this would happen in fields which are descriptions). In the screenshot below, the third line has an extra delimiter.
  2. Data Split: The second most common data issue is the splitting of data lines. This issues causes the data lines to be split across 2 or more lines in the raw file. The same would be reflected in the imported table in ACL. The screenshot below illustrates such an issue. The 6 line in the file has a new line character which is causing the data lines to be shifted to the next line.

Simply having the knowledge of such issues is not enough if these can’t be identified. After all, it is impossible to locate such issues in large files when working on a live project. The fastest way to identify these issues after import are as follows:

  1. Classify Command: In most kinds of data files, certain data columns have a certain set of unique values or similar looking values. For example, a data column like ‘Payment_Mode’ would only have a few possible values like ‘Card’, ‘Cash’ etc. Using the classify command on such a column, should have such values only. If there are any other values, go to the data lines with these values and verify those in the raw data file.
  2. Summarize Command: The summarize command works like the classify command to provide unique values in a column. However, along with the unique values in the column, the summarize command also provides information of the total line counts for each of the unique value and even subtotals for any numeric fields in the data. This information can be further used to locate any problem lines.

You can refer to the ACL Audit Command Language Help for more details on the syntax for these commands. There would be dedicated posts and videos detailing the use of the above statements.

There are some other techniques that you may leverage to identify such issues. There are some helpful tips in the videos below:

Data Spills

Data Split

There are a number of issues that can occur when importing data files. Now that you are aware of the most issues and how to locate the same, you can investigate your data imports for accuracy. This is probably the most tedious exercise, but also the most important, as incorrectly imported data would affect the outcome of the analytics performed.

Please keep practicing and feel free to reach out to us with your valuable feedback and comments. Please go to 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.

 

Audit Command Language – Print Image Files

Hello again to the series for ‘Audit Command Language Tutorial for Beginners’. For readers, who have been following along the series, should currently be working trying to import data files. So far we have discussed how to import delimited text files & importing excel files. As common as these inputs files are, there is another approach that is extremely useful to learn because life has a way to throw a curve ball when you least expect it. This approach is useful for ‘Print Image’ files. These files are typically in a ‘.pdf’ or ‘.txt’ format where the layout is laid out rather unconventionally yet in a consistent pattern, which can be imported into ACL.

A print image file would look somewhat like this:

import-prn-step-1

The key difference in such a file is that there are no delimiters to separate the columns. Additionally, there is information like the date in the top right corner to be captured along with each line of the detail lines in the data.

Let’s consider an example :

import-prn-step-2

In the above example, there are more data points which form a part of the set of data points, which are to repeated for each of the details lines. These data points appear to be ‘Contact’, ‘Account Number’, ‘Customer’, ‘Order Number’ & ‘Ship Date’.

Now that we can identify the relevant parts of a print image file, lets list down steps to identify the structure of the table that would be created using such a file:

  1. Identifying the Detail Lines – The details lines are the lines are the unique data lines. These are the columns labelled ‘Media’, ‘QTY’, ‘Description’, ‘Label/No.’ etc. All these values are with the exception of column ‘Media’ need not be repeated to fill in a table i.e. the value ‘CD’ for column ‘Media’ needs to repeated for each of the lines below for order number 536118.
  2. Identifying the Header Lines – These are lines which are forming the header section of each block of data. In our example the values for ‘Contact’, ‘Account Number’, ‘Customer’, ‘Order Number’ & ‘Ship Date’ are the header lines. These lines are meant to be repeated across all the individual detail lines for each block. Try and imagine, 4 data lines with ‘Order Number’ as ‘536118’, ‘Contact’ as ‘Marvin Mabry’, ‘Account Number’ as ‘17959’ etc.

A combination of the header and the detail lines would create the complete individual data lines for the final imported table in ACL Audit Command Language. The procedure to import such files is bit more complicated than simple delimited files. The method is covered in the two videos below:

Import Print Image files – Part 1

Import Print Image files – Part 2

It is understandable that when attempting this exercise, you should face some issues. Please leave comments in the videos above on the channel or here on the website. This approach is not just restricted to data import in ACL Audit Command Language. Understanding this concept would allow you to work across different tools. It is imperative that you practice with sample data files. If you need sample files, we can certainly share some. Another good resource for sample files would be a monarch tutorial. It should be available for free online.

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.