Variable Text Blocks
About variable text blocks
Using scripts and conditions you can control whether a text block is inserted into a document.
In some cases, the text block to be inserted can be directly linked to a value in the data.
Example The text block to be inserted depends on the country of the recipient.
So that you do not have to predefine all text blocks that might possibly be required in the document structure and then activate or deactivate the required text block by way of conditions, it is possible to define a placeholder text block. This placeholder text block is replaced during document generation by the required text block depending on the data content.
Notes
To detect any variable text blocks that were not found, check the MissedObjects bundle property in a script. The content of MissedObjects is cleared before every document generation.
In general, the scripts assigned to the BeforeInsert and AfterInsert events of the placeholder text block are executed.
If no scripts are assigned to the placeholder text block for these events, then the scripts of the inserted text block are executed.
You can insert manual variables contained in the placeholder object in the input dialog box for manual entry and use these variables in scripts of the placeholder objects.
However, the variables are not inserted into the generated document.
You should not use manual variables in the text blocks to be inserted, because the input dialog box for manual entry does not display for variable objects.
However, the variables are inserted into the generated document.
Define a variable text block
To define a text block object as a variable text block, complete the following steps.
1. Open the text block.
2. In the Object Inspector pane, right-click the VariableObjectDefinition property and click Create.
3. In the Object Inspector pane, in the Object Definition section, click the plus to the left of
VariableObjectDefinition.
As a result, the following additional properties display below the object definition.
AttributeName
DataLink
DataSource
LookupSource
LookupKey
XPathExpression
Note These properties define the data field that contains the name of the text block to be inserted.
For more information, refer to Variable Properties .
4. Perform one of the following options.
In the Object Inspector pane, in the Object Definition section, type a value for the properties
AttributeName and DataLink.
Perform the following substeps.
75
1. In the Object Inspector pane, in the Object Definition section, click the XPathExpression property, then click the ellipsis button next to the property.
2. In the Open dialog box, select an XML file.
3. In the XPath Evaluator dialog box, in the Sample XML tree box, right-click the variable that you want to assign to the text block variable, then click Copy XPath.
4. In the XPath Expression box, right-click and click Paste.
5. Click the Evaluate button.
6. In the XPath Result box, check the result.
7. Click the Apply button.
5. Select a value for the property DataSource.
6. Optional. To define an alias table to look up the value retrieved, use the property LookupSource.
For more information, refer to Create an alias table.
76