Variables and Collections

Doc Auto Team
Doc Auto Team
  • Updated

Variables refer to a value that can change, depending on any conditions or on the information stored in a system. In a coded document, a variable represents the data stored in Athennian. As discussed in the Elements of Athennian Coding Syntax article, there are two distinct types.

Types of Variables

Single (or Flat) Variables

These always contain one single piece of data, and are used to pull that specific piece of data from the database, for example:

{shareholdingName} refers to a specific shareholder's name as it appears on title.

Collection (or Plural) Variables

Collection variables specify the category of data to pull information from, and are used to organize multiple single variables into a more structured form, for example:

{#shareholdings} contains the information of all the shareholders present in the current record. 

Accessing Variables Within a Collection

In the above example, in order to get a list of the individual shareholder names {shareholdingName}, we would need to access the data that is stored within the {#shareholdings} collection. To access the individual data stored in the collection, we instruct the system to loop through all available data which matches our criteria. Once there is no more data that corresponds with our criteria, the loop will stop repeating and end. 

Syntax

  • {#} the hashtag (or pound sign) - opens a collection to begin a data loop
  • {/} the forward slash - closes a collection to indicate the end of a data loop

All {#} opening tags must have a corresponding {/} closing tags, and everything that appears between the {#} and {/} will be included within each repeated loop. The location of the closing tag is very important and could cause errors if misplaced or omitted. 

Sample Shareholdings Data

Fiona Forrest holds 100 Common shares

Gemma Germinate holds 50 Common shares

Herbert Horticulture holds 100 Common shares

Isabella Iridescence holds 25 Common shares

Julian Juniper holds 10 Common shares

 

Single Variable

Input Output
{shareholdingName} Fiona Forrest
Collection (Loop)

{#shareholdings}{shareholdingName}

{/}

Fiona Forrest

Gemma Germinate

Herbert Horticulture

Isabella Iridescence

Julian Juniper

Collection Loops

When looping through collections, the data is most easily presented in a List or Table format. For more information on how to code lists and tables, check out the Collection Variables: Lists and Collection Variables: Tables articles.