Updated: 2023-02-02
Join field codes with a specified separator using the join() function. This shortens the code and allows you to use the same code for single taxpayers and spouses because if the field is empty for one of the field codes, TaxCycle will not add the separator.
You can also nest joins for further effect. For example, 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, it displays: Mr. Sims. For a taxpayer with a spouse, is displays Mr & Mrs Sims.
Code | Possible Results |
---|---|
{{ join(" ", join(" & ", CurrentClient.Info.ID.Title, CurrentClient.Info.SpouseID.Title), CurrentClient.Info.ID.LastName) }} |
Mr Chan Mr & Mrs Sims |
Code | Possible Results |
---|---|
{{ join(" & ", CurrentClient.Info.ID.FirstName, CurrentClient.Info.SpouseID.FirstName) }} |
Howard |
Code | Possible Results |
---|---|
{{#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 |
Code | Result |
---|---|
{{join(" ", CurrentClient.Info.ID.FirstName, CurrentClient.Info.Info.ID.Initial, CurrentClient.Info.ID.LastName) }} |
James Fielding |
{{join(", ", CurrentClient.Info.ID.LastName, join(" ", CurrentClient.Info.ID.FirstName, CurrentClient.Info.ID.Initial)) }} |
Fielding, James |
{{join(" ", CurrentClient.Info.ID.Title, CurrentClient.Info.ID.FirstName, CurrentClient.Info.ID.LastName) }} |
Mr James Fielding |
{{join(" ", join(" & ", CurrentClient.Info.ID.Title, Info.SpouseID.Title), CurrentClient.Info.ID.LastName) }} |
Mr & Mrs Fielding |