enfr

Operators and functions

Updated: 2018-08-23

Operators for building logic

Operator Description

and

Tests that both statements are true.
or Tests that either statements are true.
> (greater than) Tests that the value of the first statement is larger than the value of the second statement.
< (less than) Tests that the value of the first statement is smaller than the value of the second statement.
>= (greater than or equal to) Tests that the value of the first statement is larger than or equal to the value of the second statement.
<= (less than or equal to) Tests that the value of the first statement is smaller than or equal to the value of the second statement.
= (equal) Tests that the statements produce identical results.
!= (not equal) Tests that the statements produce different results.
not()

Wrap a field or statement in not() to indicate that it is the opposite. This is particularly useful when when writing a condition for an empty field. For example, to show something when the transit number field on the T1DD is empty:

{{not(CurrentClient.T1DD.WITB.BranchNumber)}}

isblank()
or
isempty()

Tests whether a field is blank. Especially useful when testing for the presence of a date in a field. For example, to check whether that there is no spouse date of death on the Info worksheet:

{{isblank(CurrentClient.Info.Filing.SpouseDateOfDeath)}}

Combine this with the not() function to do the reverse, test whether the field has something in it. For example, to test that there is a spouse date of death on the Info worksheet:

{{not(isblank(CurrentClient.Info.Filing.SpouseDateOfDeath))}}

 

Note: There is no "else" operator, you need to reverse the condition.

Aggregate function

You can aggregate amounts from a field on a particular form. This looks at that field on all the forms in a multi-copy form and adds them together, without specifying the field on each form.

  1. Place parentheses ( ) around the field code, within the double braces {{ }} (curly brackets).
  2. Add aggregate in front of the opening parenthesis ( (do not leave any space between it and the parentheses).
  3. Remove the [0], or other number, after the form type.
  4. Add a comma, and then enclose the remaining of the field code in parentheses.
Example Sample result
{{CurrentClient.T2125Forms[0].T2125.Expenses.GrossProfit}}
{{CurrentClient.T2125Forms[1].T2125.Expenses.GrossProfit}}

17776 (on the first T2125)
82738 (on the second T2125)

{{aggregate(CurrentClient.T2125Forms,"T2125.Expenses.GrossProfit")}}

100514

{{format(aggregate(CurrentClient.T2125Forms,"T2125.Expenses.GrossProfit"))}}

100,514 

Join function

You can join field codes with a specified separator using the join( ) function. This both shortens the code and allows you to use the same code for single taxpayers and spouses because if the field is not complete for one of the field codes, the separator is not added. You can also nest joins for further effect.

A good example of this is if you need to say "Mr Sims" if the taxpayer is single, but "Mr & Mrs Sims" when the taxpayer is in a couple. Use the following code:

{{ join(" ", join(" & ", CurrentClient.Info.ID.Title, CurrentClient.Info.SpouseID.Title), CurrentClient.Info.ID.LastName) }}

  • For a single taxpayer, you would see: Mr Sims
  • For a taxpayer with a spouse, you would see: Mr & Mrs Sims
Example Code Result
(depending on client data)
Salutation with the last name, when either single or coupled. {{ join(" ", join(" & ", CurrentClient.Info.ID.Title, CurrentClient.Info.SpouseID.Title), CurrentClient.Info.ID.LastName) }} Mr Chan
Mr & Mrs Sims
Just first names, whether coupled or single. {{ join(" & ", CurrentClient.Info.ID.FirstName, CurrentClient.Info.SpouseID.FirstName) }}

Howard
Howard & Juliette

Also test wether whether the first or last names are different. {{#CurrentClient.Info.ID.LastName = CurrentClient.Info.SpouseID.LastName}}
{{ join(" ", join(" & ", CurrentClient.Info.ID.FirstName, CurrentClient.Info.SpouseID.FirstName), CurrentClient.Info.ID.LastName) }}
{{/CurrentClient.Info.ID.LastName = CurrentClient.Info.SpouseID.LastName}}
{{#CurrentClient.Info.ID.LastName != CurrentClient.Info.SpouseID.LastName}}
{{ join(" & ", join(" ", CurrentClient.Info.ID.FirstName, CurrentClient.Info.ID.LastName), join(" ", CurrentClient.Info.SpouseID.FirstName, CurrentClient.Info.SpouseID.LastName)) }}
{{/CurrentClient.Info.ID.LastName != CurrentClient.Info.SpouseID.LastName}}

Howard Chan
Thomas & Abigail Sims
Howard Chan & Juliette Thompson

Here are a few other examples:

Join field code example

Mask function

You ca mask the output from a field code by adding mask( ) around the field code. For example, if you want to partially hide a bank account number, social insurance number or phone number. It is not required, but we recommend using the format( ) tag as well so that you retain the format even though it is masked. A few examples:

Mask preview and result