2018.2

Table Of Contents
certain region on the page. However, the data can be spread over multiple lines and multiple
pages:
l Line items may continue on the next page, separated from the line items on the first page
by a line break, a number of empty lines and a letterhead.
l Data may vary in length: a product description for example may or may not fit on one line.
How to exclude lines from an extraction is explained in another topic: "Extracting transactional
data" on page186 (see From a PDF or Text file).
This topic explains a few ways to extract a variable number of lines.
Text file: setting the height to 0
If the variable part in a TXT file is at the end of the record (for example, the body of an email)the
height of the region to extract can be set to 0. This instructs the DataMapper to extract all lines
starting from a given position in a record until the end of the record, and store them in a single
field.
This also works with the data.extract() method in a script; see "Examples" on page338.
Finding a condition
Where it isn't possible to use a setting to extract data of variable length, the key is to find one or
more differences between lines that make clear how big the region is from where data needs to
be extracted.
Whilst, for example, a product description may expand over two lines, other data - such as the
unit price - will never be longer than one line. Either the line above or below the unit price will
be empty when the product description covers two lines.
Such a difference can then be used as a condition in a Condition step or a Case in a Multiple
Conditions step.
A Condition step, as well as each Case in a Multiple Conditions step, can only check for one
condition. To combine conditions, you would need a script.
Using a Condition step or Multiple Conditions step
Using a Condition step ("Condition step" on page207) or a Multiple Conditions step ("Multiple
Conditions step" on page210) one could determine how big the region is that contains the data
that needs to be extracted.
In each of the branches under the Condition or Multiple Conditions step, an Extract step could
Page 198