Edit Content
Click on the Edit Content button to edit/add the content.

The PrefixWith and SuffixWith Functions


This function is particularly useful in the situation where, say, you have an address consisting of data elements AddressLine1AddressLine2AddressLine3, 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:

«AddressLine1»«If(AddressLine2 != '')», «AddressLine2»«End()»«If(AddressLine3 != '')», «AddressLine3»«End()»«If(AddressLine4 != '')», «AddressLine4»«End()»

which will work, but is tedious to type and not easy to read.

With PrefixWith you can now type this:

«AddressLine1»«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:

«SuffixWith(Title,' ')»«SuffixWith(FirstNames,' ')»«LastName»

In the case where, say, the Title or FirstNames are empty, the trailing space will not be rendered into the assembled document.

Table of Contents