Menu

join()

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.

Salutation with the last name, whether single or coupled

Code Possible Results
{{ 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

Code Possible Results
{{ join(" & ", CurrentClient.Info.ID.FirstName, CurrentClient.Info.SpouseID.FirstName) }}

Howard

Howard & Juliette

Test for different the first or last names

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

Thomas & Abigail Sims

Howard Chan & Juliette Thompson

More examples

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