Logic statements can be used in both mathematical calculations and conditional (IF) statements. There are different ways to use logic depending on what your end result needs to be.
Conditional statements are also called IF statements.
Syntax
Conditional statements are also called IF statements.
Opening Tag
The opening tag is the hashtag and the collection you are testing {#collectionName}.
Closing Tag
The closing tag is the backslash {/}.
You can use a combination of the symbols on the table below to create IF statements.
> |
gt |
Greater Than |
< |
lt |
Less Than |
>= |
gte |
Greater Than or Equal To |
<= |
lte |
Less Than or Equal To |
== |
equal |
Equals or Match |
!= |
unequal |
Does Not Equal or No Match |
Conditionals for Booleans
Booleans (true/false) variables can be used with the symbol syntax for conditionals.
|
Unanimous shareholder agreement |
This sentence will appear if there is a unanimous shareholder agreement. |
No unanimous shareholder agreement |
This sentence will appear if there is NOT a unanimous shareholder agreement. |
Conditionals for Matches
Matching the contents of variables can be found with the symbol syntax for conditionals.
|
Jurisdiction is Alberta |
Print this text if the jurisdiction is Alberta. |
Jurisdiction is Ontario. |
Print this text if the jurisdiction is NOT Alberta. |
Conditionals for Numeric Variables
Matching the contents of variables can be found with the symbol syntax for conditionals.
|
Voting percentage = 65% |
This sentence will be printed if the voting percentage is greater than or equal to 50%. |
Voting percentage = 40% |
This sentence will be printed if the voting percentage is less than 50%. |
Conditionals with Count
There are cases where you’ll want to count how many instances are in a collection.
Example: Counting the number of directors
We will start with the count syntax.
{directors | count}
We want to include plural options and singular options in a sentence:
The director(s) is/are present.
We want to use the letter syntax (as shown in the second column above). We want to make sure we include all options in our coding:
The director{#directors | count | gt:1}
s are{/}{#directors | count | gt:1}
is{/}
present.
Pay close attention to spacing and how conditionals will affect it.
Note: Using the # in this case will not open a collection when using the count function. You will still have to open a collection inside the count condition.
Example:
{#directors | count | gt:1}{#directors}{name}
{/}{/}