Athennian supports advanced data processing coding inside of the document to help your team produce sophisticated documents accurately and quickly. This article will cover three major operations: filters, counting and limits. These operators are added to variables in the syntax. 

Variable Filters

The variable filter enables you to filter your results for only data that you need. For example, if you want to loop the names of all transactions, but only transactions that are confirmed, and not cancelled or pending transactions, the syntax will look like this:

{#transactions | status:'Confirmed'} {shareholdingName} {/} 

Here is another example to filter for only directors whose registered address is in the city of Calgary with multiple variables:

{#directors | city:'Calgary'} {name} {address} {/}

Variable Filters: Defined and Ad Hoc

There are two ways you can filter variables. The first is using our pre-defined filters and the second is to create your own filters as needed. 

Our pre-defined filters include the following (we will update this list as we add more over time) that can be applied to any variable that has one of these attributes. You can see what variables have these attributes in the Coding Reference Guide (Link: https://goo.gl/kzBEwf). 


Ad Hoc Filters

In addition to Defined filters, you can also create ad hoc filters for whatever variable you want by declaring the ad hoc filter in place of a pre-defined filter with the following syntax: "filter: {variable name}:"

For example, if you want to only list out shareholdings that have voting shares you can write that in this format:

{#shareholdings | filter:'voting':'true'} {name} {shares} {class} {/}

This statement will list all the names of the shareholdings, the amounts of shares and the classes of shares for all shareholdings that hold voting shares in the entity. 

Sort Filters

When looping data, the sort filter will let you automatically sort data alphabetically or numerically in ascending order. This is help for reports and other documents with large volumes of similar data. 

The syntax for the sort filter is:


When used in a loop, it looks like this: 

{#directors | status:'Confirmed' | sort'firstName'}{firstName}{lastName} {/} 

If the confirmed directors are stored in Athennian in this order based on the order they were first added to the database: 


The sorting filter will organize them in the loop alphabetically in the document as follows: 


Applying the sort filter to variables that are numbers will sort those values numerically in ascending order in a loop. 

Limit Filters

The limit filter allows you to limit the number of results that Athennian prints to a document in a loop. This can be used when you only want a certain number of results in a looped table or list.

In the following example, the loop will be limited to listing 50 shareholders that are resident in the USA and sorted alphabetically by state of their address registered with the company: 

{#shareholders | country:"USA" | sort:"stateProvince" | limit:50}{firstName}{lastName} {/}


The counting operation is a powerful operation that can be used to count the number of times a specific record appears. With that number returned, we can do further calculations, automate text or just print out the number for reports. 

An obvious use case for the count function is automating pro-nouns in the text of a document depending on if there is one subject or more than one subject (e.x., directors, vendors, etc.). 

The basic syntax for counting is as follows (with directors as the example data): 

{directors | count}

Assuming there are three director records, this function will return the following value into the document: 


If we want to filter for any certain types of records we can add a filter as well. For example, let's assume that of the three directors, 1 is an inactive record and 2 are active confirmed records. We may only want to know the number of active directors in the company. To achieve this we would add the below filter to the count: 

{directors | status:'confirmed' | count}

This will return the following value to the document:


Now that we have the basics of counts, we can add some more advanced operations to automate the placement of text such as pluralizing or singularizing sentences based on the number of records. 

Did this answer your question?