What are variable assignments?
Similar to a custom prompt, an assignment is a custom variable that is defined within the document. We use them for two main reasons:
- To simplify frequently used code that is long (eg. pluralization logic)
- To access out-of-collection variables in order to leverage them for logic (eg. accessing the {entity_jurisdiction} variable from within the {#directors} collection, to evaluate the appropriate legislation)
There are 2 main steps to using variable assignments:
- Define the assignment
- Insert the assigned variable into your document
Step 1: Define the variable assignment
Rather than using {#directors | status:’incoming’:’confirmed’ | count | gt:1}all of the directors{/}{#directors | status:’incoming’:’confirmed’ | count | lt:2}the sole director{/} every single time we want to insert the appropriate director phrase, we can simply define it as an assigned variable.
{#directors | status:’incoming’:’confirmed’ | count | gt:1}{dirPhraseAssign=’all of the directors’}{/}{#directors | status:’incoming’:’confirmed’ | count | lt:2}{dirPhraseAssign=’the sole director’}{/}
Step 2: Insert the assignment into the body of your document
The foregoing resolutions are hereby approved by {dirPhraseAssign} of the Corporation.
- Depending on the composition of the board (single or multiple directors) for the entity record, the appropriate phrase (“all of the directors” or “the sole director”) will populate in the sentence.
Syntax
- If your custom assignment is logic based, then the definition should be wrapped in logic, similar to the count logic used above
- Name the custom variable assignment something distinct (see below for Best Practices)
- Assignments are defined with a single = sign
- Hardcoded words are enclosed in 'single quotes'
- Existing Athennian variables are enclosed in (brackets)
- Whenever we are mixing string and variable, we just need to close out the single quotes (with any appropriate spacing included inside the quotes) and add (+) before any variables to join them to the hardcoded words
- Any special characters (, ; ‘ “ ) can be escaped with \ as they will not show up otherwise
Assignment Best Practices
-
To avoid these from being picked up by the document previewer or being visible in document management systems (and confusing users) while ensuring they are evaluated before being used in the collections, we hide these assignments in the document properties area.
-
As a best practice we also append -Assign to all our assignments so we can easily identify them as such and to avoid overlapping existing variables in Athennian, which may interfere with your other coding in the document.
-
You can define multiple assignments associated with a single logic statement. An example of this is pluralization language:
Sample assignment: {#directors | status:’incoming’:’confirmed’ | count | gt:1}{dirPhraseAssign=’all of the directors’}{dirPluralAssign=’s’}{/}{#directors | status:’incoming’:’confirmed’ | count | lt:2}{dirPhraseAssign=’the sole director’}{dirConjugationAssign=’s’}{/}
Sample template code: By virtue of their signature{dirPluralAssign} hereto, {dirPhraseAssign} of the Corporation hereby approve{dirConjugationAssign} the foregoing resolutions.
Depending on the composition of the board for the entity record, the appropriate grammar will be applied to the sentence: a) “signature(s)” for multiple directors; b) “all of the directors” or “the sole director;” and c) “approve(s)” for a sole director.
-
Using assignments to insert out-of-collection variables or logic within a collection is the original purpose of the assignments, but it is also one way we try to simplify the code. For example with the above example of pluralization language, by using the assignments, we only have to define the logic/variable once, and thereafter can insert the assignment:
Example:
Code Without Assignments = 323 characters
{#directors | status:'confirmed':'incoming' | count | lt:2}The sole director of the above noted Corporation hereby consents to the above resolutions as evidenced by the signature{/}{#directors | status:'confirmed':'incoming' | count | gt:1}All of the directors of the above noted Corporation hereby consent to the above resolutions as evidenced by the signatures{/} hereto.
Simplified code with Assignments = 148 characters
{dirPhraseAssign} of the above noted Corporation hereby consent{dirConjugationAssign} to the above resolutions as evidenced by the signature{dirPluralAssign} hereto.
Comments
0 comments
Please sign in to leave a comment.