Updated: 2024-01-04
Field codes and constants are the basis of any expressions you create in the Template Editor or the Data Monitor, so understanding how to add and format them is the first step to building conditional content.
Field codes allow you to extract information from a tax return. They are also used to build conditional statements. Use field codes in templates, data monitors and in print set conditions. Field codes used in templates, along with constants and conditions, are enclosed in double braces {{ }}
(curly brackets).
Right click on the field and select one of the Copy field code options:
CurrentClient.Engage.Preparer.ClientID
. Use this in the Data Monitor, as well as in print set and template conditions.{{CurrentClient.Engage.Preparer.OfficeID}}
. Use this format in Templates.CurrentClient.
prefix.{{CurrentClient.Info.ID.FirstName}}
will insert the first name of the client (as long as there is a first name in the field).You can use workflow items in templates. To copy the IDs from the workflow screen:
Field codes are divided into parts that narrow down the content within a tax return. Split them up to figure out what form they appear on or to shorten your statement.
The following is the field code for the First name field on the Info worksheet in TaxCycle T1. This is exactly how it would appear if you copied it from the field.
{{CurrentClient.Info.ID.FirstName}}
CurrentClient | This tells the Template Editor to extract the data from the visible or active client. For example, if you are printing a letter from a tax return for the principal taxpayer (not the spouse). But, if you are viewing the tax return of the spouse, it will extract information from the spouse, CurrentClient refers to the principal taxpayer. On the other hand, if you are viewing the letter for the principal taxpayer, but you want to include information for the spouse, you would use CurrentSpouse instead. See Clients and Taxpayers. |
Info | This points to the Info worksheet. |
ID | This points to the ID section on the Info worksheet. |
FirstName | This points to the specific name field for the client's first name, within the Info worksheet, under the ID section. |
You can use these components to simplify your code. For example, look at the following pieces of code for inserting the taxpayer's address in a letter. By turning the common parts of this group of field codes into a condition (creating an opening statement of {{# CurrentClient.Info }}
and a closing statement of {{/ CurrentClient.Info }}
. They both do the same thing, but the one on the left is much easier to read and work with.
|
|
Why is this important? Not only does it help you read the code more easily, but as you move on to create your own conditions, you will likely look at built-in templates where we have simplified the code quite in this way. If you copy and paste existing code from there into a new template, it helps to know that you might need the {{# CurrentClient }}
parent tag or the CurrentClient prefix (or others) to make the code work.
The field codes from multi-copy forms or slips contain a number in them to refer to the specific copy. For example:
{{T4Slips.T4[0].CurrentYear.M[2]}}
{{T4Slips.T4[1].CurrentYear.M[2]}}
{{T4Slips.T4[2].CurrentYear.M[2]}}
The [0], [1] and [2] indicate different copies of the same type of slip, in this case the T4 slip.
The numbering of a form or slip always starts at zero. If you see a [-1], it refers to a blank slip. This changes when you start typing in the form or slip.
The field codes from expanding tables contain a number in them to refer to the specific row. For example:
{{MedicalExpenses.ExpensesDetails[0].Amount}}
{{MedicalExpenses.ExpensesDetails[1].Amount}}
{{MedicalExpenses.ExpensesDetails[2].Amount}}
The numbering of a row always starts at zero. If you see a [-1], it refers to a blank row. This changes when you start typing in the row.
To display the value of a check box, add the box to the Data Monitor:
Most check boxes in TaxCycle allow you to select only one from the list, like the principal residence question on T1 Schedule 3. These style of check boxes have a single name in the left side of the data monitor and different values associated with each box.
Other check boxes allow you to select all that apply to a question. Such as the questions in Part A of the T1135. Behind the scenes, these are different. Each box has a different name and value, so you need to add each box to the Data Monitor to see the value, rather than adding just one and switching between them.