The PrefixWith and SuffixWith Functions
This function is particularly useful in the situation where, say, you have an address consisting of data elements AddressLine1, AddressLine2, AddressLine3, and AddressLine4, but that perhaps lines 2, 3 and 4 are empty. Further, you want to present the address in a single line, with the different AddressLine data elements separated by commas.
You could code this as:
If(AddressLine2 != '')», «
If(AddressLine3 != '')», «
If(AddressLine4 != '')», «
which will work, but is tedious to type and not easy to read.
With PrefixWith you can now type this:
PrefixWith(AddressLine2, ', ')»«
PrefixWith(AddressLine3, ', ')»«
PrefixWith(AddressLine4, ', ')»
Whereas PrefixWith is useful for structures like addresses where usually at least the first line will have a value, SuffixWith is handy for the case of parts of a name, where sometimes the first one or two parts are unknown or not specified. The following example shows how this function would be used:
In the case where, say, the Title or FirstNames are empty, the trailing space will not be rendered into the assembled document.