Logic & Conditions

Doc Auto Team
Doc Auto Team
  • Updated

Logic is an essential part of Athennian coding syntax. Logic, or IF statements, can be used in both mathematical calculations and conditional evaluations. There are different ways to use logic depending on what your end result needs to be.

Logic or IF Statements

{#ifStatement}Conditional Content{/}

  • {#} Opening tag indicates the start of the IF statement
  • Conditional content to be inserted depending on the outcome of the logic statement evaluation
  • {/} Closing tag indicates the end of the IF statement
  • Pay close attention to spacing and how conditionals will affect it.

Symbol Syntax

Symbol Meaning Syntax
> greater than gt
< less than lt
>= greater than or equal to gte
<= less than or equal to lte
== equal or match equal
!= does not equal or no match unequal
  • By using ! syntax, you can change the logic statement from being a "match" to meaning "does not match" (or "exclude")

Single and Multi-Conditions

When coding logic, there are two ways to use conditional IF statements:

    1. To insert conditional content IF one condition is met
    2. To insert conditional content A if condition A is met, and to insert conditional content B if condition B is met

Types of Conditional Statements

Conditionals with Booleans (True/False)

Boolean-type variables (true/false) can be used for conditionals. Booleans specifically can be written in a short form. Boolean variables use the syntax for match and no match to indicate true or false conditions.

Syntax

{#logicVariable==true} OR {#logicVariable}

{#logicVariable!=true} OR {#!logicVariable}

  Sample Entity Data

Auditor has been waived

Screen

Auditor has not been waived

Screen

Input (Original) {#entities}{#waivedAuditor==true}The Auditor has been waived for the upcoming fiscal year.{/}{#waivedAuditor!=true}The Auditor has been appointed for the upcoming fiscal year.{/}{/}
Input (Short) {#entities}{#waivedAuditor}The Auditor has been waived for the upcoming fiscal year.{/}{#!waivedAuditor}The Auditor has been appointed for the upcoming fiscal year.{/}{/}
Output The Auditor has been waived for the upcoming fiscal year. The Auditor has been appointed for the upcoming fiscal year.

Conditions with Matches (String)

Conditional statements can be created by matching the value of variables. The value, or the string, must be written exactly as it appears in the system and enclosed in 'single quotes'. 

Syntax

{#logicVariable=='matchingValue'}

  Sample Entity Data

Jurisdiction: Alberta

Screen

Jurisdiction: Ontario

Screen

Input {#entities}{#jurisdictionRegion=='Alberta'}The Corporation is domiciled in Alberta.{/}{#jurisdictionRegion!='Alberta'}The Corporation is not domiciled in Alberta.{/}{/}
Output The Corporation is domiciled in Alberta. The Corporation is not domiciled in Alberta.

Conditionals with Number-type Variables

Conditional statements can be created by evaluating a number-type variable against a numerical condition. Symbols may be used to match the contents of the variable.

Syntax

{#logicVariable==numberValue}

  Sample Shareholdings Data

Julian Juniper - 10 Common

Kiefer Kernel - 1 Common
Input {#shareholdings}{shareholdingName} holds {numShares | commaSeparate} share{#numShares>1}s{/}.{/}
Output Julian Juniper holds 10 shares. Kiefer Kernel holds 1 share.
 

Conditionals with count and sum Functions

The count and sum functions result in numerical output, which allows the result to be evaluated as a number-type variable. Symbol or letter syntax may be used to match the contents of the variable. For more information on the count and sum functions, check out Counting Data and Getting an Aggregate Amount using Sum.

Syntax

{#logicCollection | count | gt:numberValue}

  Sample Shareholdings Data

Fiona Forrest - 100 Common

Gemma Germinate - 50 Common 

Herbert Horticulture - 100 Common

Isabella Iridescence - 25 Common 

Julian Juniper - 10 Common

Kiefer Kernel - 1 Common
Input {#shareholdings | count | gt:1}There are multiple shareholders in the Corporation.{/}{#shareholdings | count | lt:2}There is only one shareholder in the Corporation.{/}
Output There are multiple shareholders in the Corporation. There is only one shareholder in the Corporation.

Logic vs Collections

Although both logic and collection looping uses the same opening {#} and closing {/} tags, they are not the same. Collections must be opened separately from a logic statement in order to access the data therein. As we saw in the above example, count logic will usually wrap around a collection, unless the conditional statement is evaluating a specific variable within a collection, then the collection must be opened first.

Logic Around Collections

  Sample Shareholdings Data

Fiona Forrest - 100 Common

Gemma Germinate - 50 Common 

Herbert Horticulture - 100 Common

Isabella Iridescence - 25 Common 

Julian Juniper - 10 Common

Kiefer Kernel - 1 Common
Input {#shareholdings | count | gt:1}{shareholdings | toSentence:'shareholdingName'} are the shareholders of the Corporation.{/}{#shareholdings | count | lt:2}{#shareholdings}{shareholdingName} is the only shareholder of the Corporation.{/}{/}
Output There are multiple shareholders in the Corporation. There is only one shareholder in the Corporation.

Logic Within Collections

  Sample Share Classes Data

Common - voting

Class A Special - non-voting

Class A Common - voting

Class B Special - non-voting

Class B Common - voting

Class C Special - non-voting

Class C Common - voting

Preferred - non-voting

Input (Original)

{#shareclasses}Holders of {className} shares {#votingRights==true}have{/}{#votingRights!=true}do not have{/} the right to vote on the matters of the Corporation.

{/}

Input (Short)

{#shareclasses}Holders of {className} shares {#votingRights}have{/}{#!votingRights}do not have{/} the right to vote on the matters of the Corporation.

{/}

Output

Holders of Common shares have the right to vote on the matters of the Corporation.

Holders of Class A Special shares do not have the right to vote on the matters of the Corporation.

Holders of Class A Common shares have the right to vote on the matters of the Corporation.

Holders of Class B Special shares do not have the right to vote on the matters of the Corporation.

Holders of Class B Common shares have the right to vote on the matters of the Corporation.

Holders of Class C Special shares do not have the right to vote on the matters of the Corporation.

Holders of Class C Common shares have the right to vote on the matters of the Corporation.

Holders of Preferred shares do not have the right to vote on the matters of the Corporation.