XpressDox Help Center

Use Google To Find Help Fast, e.g. xpressdox choosefromlist


Press Getting Started in the XpressDox toolbar for basic template development
Watch the tutorial videos
View command help from list of commands
Press F1 for help on a command in the Command Editor
Email support@xpressdox.com for assistance

Suppressing empty lines in your assembled document


Suppressing empty lines in your assembled document

Suppose you have an address captured as four separate data elements. Typically the Address section of a letter would then look like:

<<AddressLine1>>
<<AddressLine2>>
<<AddressLine3>>
<<AddressLine4>>
<<PostalOrZipCode>>

But sometimes the fourth, or maybe even the third, lines are empty, and you normally don’t want to leave an empty line between the last non-empty address line and the PostalOrZipCode.
Here is what to do:

<<AddressLine1>>
<<AddressLine2>>
<<ShowIfHasValue(AddressLine3)>>
<<ShowIfHasValue(AddressLine4)>>
<<PostalOrZipCode>>

When a template like this is run, if the AddressLine3 data element is empty, then the entire line on which the fillpoint <<AddressLine3>> appears will be removed from the merged document. The same applies to <<AddressLine4>>.

Prior to version 3.9.3 (when the ShowIfHasValue function was introduced), the way to achieve the suppression of empty lines was as follows (shown here in case you have seen code like this in templates)

<<AddressLine1>>
<<AddressLine2>>
<<If(AddressLine3 != “”)>>
<<AddressLine3>>
<<End()>>
<<If(AddressLine4 != “”)>>
<<AddressLine4>>
<<End()>>
<<PostalOrZipCode>>

 Notes:

  • When an If command is the only text in a paragraph, then that paragraph will not appear in the merged document. The same applies to the End() command (and numerous other commands, e.g. ForEach, Else(), and the various ChooseFrom... commands, etc.) which, when they are the only text in a paragraph, will result in that entire paragraph being removed from the merged document.
  • The symbol != means “is not equal to”.

Leave a Reply