Working with Embedded Links for Data Import, Comparison, Styling, and Slip Sheets
DesignMerge software supports a unique feature called Embedded Links. An Embedded Link is a way to import data taken from a different Variable Link, and to place that data anywhere in the middle of the data you are already merging. The Embedded Link is automatically substituted with the data taken from the referenced link during the merge session.
EMBEDDED LINK FORMAT
An Embedded Link uses a simple text format that can be placed directly into the data being imported by DesignMerge during a merge session. An Embedded Link has the following format:
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.
WHERE CAN YOU USE EMBEDDED LINKS?
Embedded Links in Data Files
Embedded Links can be included directly in the fields of the data file that is being processed. In this case, the Embedded Link text is placed into the data field using the syntax described earlier. When the data is imported, the Embedded Link will be swapped automatically.
Embedded Links in Rules
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.
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 Record 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.
FIRST AND LAST RECORDS
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:
First Record of the Data File
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).
Last Record of the Data File
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 essentially an end of file (EOF) error condition).
Another way to look at this is that the very First Record of the data file will always be the same as Previous (--), and the Last Record of the data file will always be different than Next (++).
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
|CS6 and above
In any of the following Rules Module Actions:
Set Data to
CC 2019 and above
Can be used with any of the Comparison Operators in the Rules Module (for example: if <MailTray> is different than "<$MailTray-->")
Exception: Cannot be used for the List set of operators (is any of , etc.)
CC 2019 and above
EMBEDDED LINK EXAMPLES
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.
Concatenate the values of two different Variable Links
[Supported in 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.
Compare two Links using Rule Criteria
[Supported in 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 will 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>
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.
Compare current record to previous record using Rule Criteria
[Supported in 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 parent 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 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 Parent Page "TrayBreak-Parent"
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 Parent Page Action, and a parent page named TrayBreak-Parent will be applied. If the values are the same (meaning the same tray is still being processed), it suppresses the slip sheet page from printing.
Apply a Parent Page from a data field
[Supported in CC 2019 and above] In this example, we have a Variable Link named ParentPageName that holds the name of a parent page to apply for the record being processed. Using an Embedded Link reference, we can read the parent page name from the data record being processed, and apply the parent page at the same time. To do this, you create a Page Rule as follows:
If Default Condition then
Apply Parent Page <$ParentPageName>
In the above example, ParentPageName refers to a Variable Link that holds the name of the parent 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 parent page to apply, the rule could have been modified to read the name of the parent page to apply from a data field instead.
Apply a character style sheet from a data field
[Supported in 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 the Embedded Link feature. If you have any questions about this feature, please feel free to open a support ticket and our team will be happy to assist.