Punctuation and spacing control for empty variable links

Sometimes, you need to have word spacing between two variable text links, but only when *both* of the variable links receive data. Or, perhaps you need a punctuation mark to follow a variable text link, but only when the variable link receives data.

For example, your variable data records may contain a Title (Mr., Ms., Mrs., etc.), and also a Name, but every record may not provide Title data. Since Title data may not be available for every record, you can set up the Title variable link to be deleted when empty. However, while you want a space between the Title variable text link and the Name variable text link in the document (Dear Mr. John Smith), you do not want the extra space (Dear  Jane Smith) to appear when the Title link is deleted. Instead you would like to omit the extra space along with the empty title variable text link (Dear Jane Smith).

In a second example, let's assume your variable data includes Name data, but not for every record. Some of the records do not provide any Name data. You would like to place a Name variable text link in a document and you also need to place a comma after the variable name (Sam Adams,). When the Name variable text link is deleted because it is empty, you do not want the comma to print alone all by itself (,). 

These types of scenarios can be handled quite easily by using variable link settings or by using a link rule. Both options are presented below:

USING VARIABLE LINK SETTINGS

You can set up a variable link to add a prefix and/or suffix to any data it receives, and you can also set up the same variable link to be deleted when it does not receive any data. If the link is deleted, the prefix/suffix will not be added. Following our first example above where we would like to display a space between Title and Name variable text links, but only when the Title variable link is not empty, follow the steps below:

  1. Open the document and then open the Variable Links dialog (DesignMerge > Setup > Variable Links).
  2. In the list on the left, select the name of the variable link (Title) to display its settings on the right.
  3. Select Delete for the Empty Link setting.
  4. Select the Suffix check box and enter a single word space as the suffix to be added.
  5. Click OK to save these changes and close the dialog.
  6. In your document, position the two variable text links so they are right next to one another with no space in between, as shown below: 
    <<Title>><<Name>>

That's it! Now when you merge, using the example above, if there is a Title in the data, it will be inserted with a space right after it to provide separation from the Name link. If there is no Title, then the Title link will be deleted, leaving the Name link visible with no space appearing ahead of it.

Setting up a variable link to add a prefix and/or suffix will add the prefix/suffix to each and every placement of this variable link in the document. If you would like some placements of this variable link in the document to add a prefix/suffix and others to not add this prefix/suffix, then use a link rule instead (described below), or use a copy of the original variable link.

To use a copy of the variable link, select the name of the variable link that you wish to copy and then click the Save As button on the Variable Links dialog. Give the new variable link an identifying name (for example "Title-Space"). Then, set up this new variable link to add the suffix. You can now assign this new variable link to text in the document wherever you wish the prefix/suffix to be added, and assign the original variable link wherever you do not wish the prefix/suffix to be added.

USING A LINK RULE

You can use a link rule to add a prefix and/or suffix to a variable link when it is not empty. If the variable link is empty, the link rule will not add the prefix/suffix. Following our first example above where we would like to display a space between Title and Name variable text links, but only when the Title variable link is not empty, follow the steps below:

  1. Open the document to access its variable links and link rules.
  2. Now, as in the previous example, set up the variable link (in this example, named Title) to deleted when empty. However, do not set it up to add a prefix and/or suffix.
  3. Open the Rules dialog for this document (DesignMerge > Setup > Rules).
  4. Create a new link rule, add one statement to the new rule, and specify the following Criteria and Action for the new statement:
            if <<Salutation>> is not empty,
            then Add Suffix: " "
  5. Click OK to save the changes to the document's rules and close the dialog.
  6. In your document, position the Title and Name links so they are right next to one another with no space in between, as shown below: 
    <<Title>><<Name>>
  7. Now, assign your new link rule to the Title variable text link.

That's it! Now when you merge, using the example above, a Title variable text link that is assigned to this Link Rule, if there is a Title in the data, it will be inserted with a space right after it to provide separation from the Name link. If there is no Title, then the Title link will be deleted, leaving the Name link visible with no space appearing ahead of it.

Using a link rule (in this example, to add a prefix and/or suffix) will affect only those variable links in the document that are assigned this rule. Other variable links in the document that are not assigned this link rule will not be affected.

For more information and an example of setting up variable links in a DDF and assigning variable links to text in a document, see Tutorial #1 (The Basics) in DesignMerge Documentation.

For more information and an example of setting up and assigning a link rule to a variable text link in a document, see Tutorial #1b (Rules) in DesignMerge Documentation