Creating an address format
If an address format is not yet available for your country, region, or postal service specific format, you could create a custom address format. This topic explains how to do that.
-
Create a text file and save it in the folder:
C:\ProgramData\Objectif Lune\OL Connect\Address Blocks
Change the file's extension into .hbs. This essentially turns the file into a Handlebars template.
The name of the file, without the extension, will now appear in the Address Block wizard, in the address format drop-down.
-
Open the file you created and write a Handlebars expression for each address field you want to appear in the address block.
The expression for an address field must contain:
-
The prefix: OLC, followed by two digits: 00 - 99. The digits determine the order of the address fields in the Address Fields column. OLC00 comes first, OLC99 comes last.
-
The address field name. If the name contains a space, surround the name with square brackets.
Example: {{OLC10firstname}} {{[OLC10last name]}}
If the address field name (without prefix and digits) happens to be the same as one of the standard address field names, it will be translated. For example, firstname will appear in the address field list as First name if the display language of the Designer is English.
-
-
Put the address fields that should be on one line in the address block into a paragraph by surrounding them with HTML paragraph tags: <p> ... </p>.
Example: <p>{{OLC10firstname}} {{OLC11middlename}} {{OLC12lastname}}</p>
-
To make sure the address block looks good even if data are missing, you will probably need to add some logic. You can do this with Handlebars Helpers; see Using functions in expressions: Helpers.
For example, you may want to have two spaces between the first and last name, but only if both names are present in a record. The line in the following example has that logic.
Example: <p>{{OLC10firstname}}#if (and {{OLC10firstname}} {{OLC13lastname}}) {{OLC12lastname}}</p>
Note: If none of the expressions in a paragraph return results, and the paragraph has no other content, the address line is empty and is automatically deleted. Empty lines do not appear in the output.