set()

Sets a new DataMapper record boundary.

set(delimiters)

delimiters

Sets a new record boundary. The delimiters parameter is an offset from the current delimiter, expressed in an integer that represents a number of delimiters.
If this parameter is not specified, then a value of 0 is assumed. A value of 0 indicates the record boundary occurs on the current delimiter.
A negative value of -n indicates that the record boundary occurred -n delimiters before the current delimiter.
A positive value of n indicates that the record boundary occurs +n delimiters after the current delimiter.

Specifying a positive value not only sets the DataMapper record boundary but it also advances the current delimiter to the specified delimiter. That's where the processing resumes. This allows you to skip some pages/records when you know they do not need to be examined. Negative (or 0) values simply set the boundary without changing the current location.

Example

This script sets a boundary when the text TOTAL is found on the current page in a PDF file.
The number of delimiters is set to 1, so the boundary is set on the next delimiter, which is the start of the next page.

if (boundaries.find("TOTAL", region.createRegion(10,10,215,279)).found) {
boundaries.set(1);
}

Assume you want to set record boundaries whenever the text "TOTAL" appears in a specific region of the page of a PDF file, but the PDF file has already been padded with blank pages for duplexing purposes. The boundary should therefore be placed at the end of the page where the match is found if that match occurs on an even page, or at the end of the next blank page, if the match occurs on an odd page. Recall that for PDF files, the natural delimiter is a PDF page. The JavaScript code would look something like the following:

var myRegion = region.createRegion(150,220,200,240);
if(boundaries.find("TOTAL", myRegion).found) {
/* a match was found. Check if we are on an odd or even page and set the Boundary accordingly */
if((boundaries.currentDelim % 2) !=0 ) {
/* Total is on odd page, let's set the document Boundary one delimiter further, thereby skipping the next blank page */
boundaries.set(1);
} else {
/* Total is on an even page, set the document Boundary to the current delimiter */
boundaries.set();
}
}
}