Updated: 2024-11-11
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 TaxCycle will not add the separator if the field is empty for one of the field codes.
You can also nest the join function for further effect. For example, this is useful if you need to say "Mr Sims" if the taxpayer is single, but "Mr & Mrs Sims" when the taxpayer has a spouse. 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, it 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 |