Working with Embedded Links

Working with Embedded Links

DesignMerge software supports a unique feature called Embedded Links. An Embedded Link is a reference to a DesignMerge Variable Link that can be included (using a simple text string format) within the data being imported by DesignMerge during a merge session. An Embedded Link has the following format:

<$VariableLinkName>

An Embedded Link reference always begins with the '<$' characters, and ends with the '>' character. Between these characters is the name of the Variable Link to process. In the above example, the text VariableLinkName represents the name of an existing Variable Link definition. As an full example, consider the following data:

Dear <$CustomerName>, your credit card will expire on <$ExpiryDate>.

In the above example, the value for <$CustomerName>, and <$ExpiryDate> would be swapped with data read from the CustomerName and ExpiryDate Variable Links for the current database record being processed.

Embedded Links can be included in the data file that is being processed. In addition, there are a number of other places where Embedded Links can be utilized, such as in the Set Data to: Rule Action. A number of examples are provided later in this document.

NEW SUPPORT FOR CREATIVE CLOUD 2019

With the release of the InDesign CC 2019 version DesignMerge, the use of Embedded Links has been enhanced. In addition to the traditional use, Embedded Link references are now supported by the DesignMerge Rules module for both Criteria evaluation and comparison, and also in Rule Actions.

USING EMBEDDED LINKS IN RULES

When you are editing Rule Criteria or Actions, there is an Edit button available on the dialog window.

The Edit button opens the Edit Rule Data dialog, which allows you to edit the text associated with the Rule or the Action you are working on, and also allows you to easily insert Embedded Link references. When you click the Edit button, the Edit Rule Data dialog window will be presented as shown below.



Use the Insert Variable Link popup menu to select the Variable Link you would like to embed. When you select a Link, a second dialog appears prompting you to select which Record Reference you wish to use. Your choices are shown in the screen shot below.



Current is the default, and this means the Embedded Link will be populated with data taken from the current record being processed. The Previous (++) option will read the data from the previous data record, and the Next (--) option reads data from the next record. The Previous and Next indication will be denoted by adding a '--' or a '++' at the end of the Variable Link name within the Embedded Link reference, as shown below.



SPECIAL SUPPORT FOR THE FIRST AND LAST RECORDS OF A DATA FILE

You may be wondering how the Previous and Next references work when the record being processed is the first record or the last record in the data file. In such case, the following rules apply:

For the First Record of the data file, the Previous (++) reference always returns the same value as the First Record (because there is no record that precedes the first record).

For the Last Record of the data file, the Next (--) reference always returns the EOF! error string (because there is no record that comes after the last record, so this is essentiallly an end of file (EOF) error condition).

Another way to look at this is that the first record of the data file will always be the same as the Previous record, and the last record of the data file will always be different from the Next data record.

WHERE CAN EMBEDDED LINKS BE USED?

The following list provides a summary of where Embedded Links may be utilized, along with the InDesign version required to support the feature.

Directly in the fields of a data file (CS6 and above)
As a Prefix/Suffix for a Variable Link (CS6 and above)
In a text string returned from a Custom Action via JavaScript (CS6 and above)

Rules Module Actions (CC 2019 and above)
      Set Data to
      Apply Char Stye Sheet
      Apply Para Style Sheet
      Apply Master Page
      Apply and Resize Master Page
      Hide Layer
      Show Layer
      Launch External Script

Rules Module Criteria (CC 2019 and above)
      Can be used for any of the comparison operators
      Exception: Cannot be used for the List set of operators (is any of , etc.)

 

SAMPLE APPLICATIONS

A number of specific examples of the use of Embedded Links are provided below. Each example also indicates the Adobe InDesign version where the feature is supported.

Example A: Concatenate the values of two different Variable Links
Supported: CS6 and above

In this example, data that is being imported from two different Variable Links is being concatenated. A good example of this is for concatenating the Zip and the Plus-4 fields for a zip code that you wish to convert into a PostNet bar code (using the _BARCODE_POSTNET keyword link). In this scenario, the 5-digit zip code, and the 4-digit supplement exist in separate data fields. In order to be converted for use with the PostNet bar code keyword Link, the data fields must be concatenated to form a single string of 9 digits. To accomplish this, you simply create a Rule defined as follows:

If Default Condition then
    Set Data to: <$ZipCode><$Plus4>

When this Rule Action is applied to a Variable Link in the document, it will override whatever data is being imported and set the incoming data string to the concatenated values from the ZipCode and Plus4 fields of the data file. As an example, if the ZipCode field contained 60173, and the Plus4 field contained 1234, the value merged into the document would be 601731234.

Example B: Compare two Links using Rule Criteria
Supported: CC 2019 and above

In this example, we are comparing the value of two different data fields to determine if they are equal to one another. If they are, then only the data from the first field wil be imported. If the data is different, then the value from the second data field will be imported instead. To accomplish this, you create a Rule defined as follows:

If LinkA is <$LinkB> then
    Set Data to: <$LinkA>
else
    Set Data to: <$LinkB>

This Rule compares the defined Variable Link called LinkA, to the Embedded Link reference for LinkB. Using the syntax above allows you to compare the values of two different Variable Links for the same record.

Example C: Compare the current record to the previous record using Rule Criteria
Supported: CC 2019 and above

In this example, we are comparing the value of a data field to the value for the previous record of the same data field. This can be useful for situations where you want to detect a change in data values during the merge. For example, in mailing applications it is often common to have a tray break field. The tray break field contains a value that ties together all of the records for a given mail tray. When there is a change in the value of the tray break field, this indicates the start of a new tray. In such case the user may wish to print a slip sheet to allow for easier separation by tray once printing is complete.

For this specific example, you will want to design your document with an extra page at the start. This can be a blank page (you can apply a master page to it using a Rule, as described below), or the page can already contain the slip sheet information you wish to print when a change in the tray break is detected. Using a Page Rule, you can detect when a tray break occurs, and in such case allow the cover sheet to print. If the tray break has not changed, then you suppress the cover sheet from printing. Using this method, the additional page you inserted (the slip sheet page) will only print when there is a change in the tray break field.

For this example, we have a Variable Link defined in the DDF named TrayBreak. The following Page Rule can be applied to the first page of the document (the slip sheet page) to set up the printing of a slip sheet whenever a change in the tray break occurs.

If TrayBreak is not <$TrayBreak--> then
    Apply Master Page "TrayBreak-Master"
else if Default Condition
    Omit Page from Printing

Note in the above example the use of '--' in the Embedded Link reference. Adding two dashes after the Variable Link name inside of an Embedded Link reference instructs the software to use the value for the previous record. For example, let's say you are processing record 152 from your data file. The Rule would compare the value for the TrayBreak Link for record 152, to the value for TrayBreak for record 151. If they are different, then this triggers the Apply Master Page Action, and a master page named TrayBreak-Master will be applied. If the values are the same (meaning the same tray break is still being processed), it suppresses the slip sheet page from printing.

Example D: Apply a master page by reading the master page name from a data field
Supported: CC 2019 and above

In this example, we have a Variable Link named MasterPage that holds the name of a master page to apply for the record being processed. Using an Embedded Link reference, we can read the master page name from the data record being processed, and apply the master page at the same time. To do this, you create a Page Rule as follows:

If Default Condition then
    Apply Master Page <$MasterPage>

In the above example, MasterPage refers to a Variable Link that holds the name of the master page to apply. Note that this same scenario could also have been applied in the previous slip sheet example. Rather than explicitly setting the name of the master page to apply, the rule could have been modified to read the name of the master page to apply from a database field instead.

Example E: Apply a character style sheet with sheet name stored in a data field
Supported: CC 2019 and above

In this example, we have a Variable Link named StyleSheet that holds the name of a character style sheet to apply for the record being processed. Using an Embedded Link reference, we can read the name of the style sheet to apply from the data record being processed, and apply the style sheet to the imported text at the same time. To do this, you create a Link Rule as follows:

If Default Condition then
    Apply Char Style Sheet <$StyleSheet>

In the above example, StyleSheet refers to a Variable Link that holds the name of the character style sheet to apply. Of course this same approach would work with paragraph style sheets just as well.

There are many uses for Embedded Link feature. If you have any questions about this feature, please feel free to open a support ticket at www.meadowsps.com/support.