1.6

Table Of Contents
Then our script would look like this:
// Read the values of both columns we want to check
var zeBand = boundaries.get(region.createRegion(1,1,30,1));
var zeYear = boundaries.get(region.createRegion(61,1,65,1));
// Check that at least one of our variables holding previous values
have been initialized already, before attempting to compare the
values
if (boundaries.getVariable("lastBand")!=null) {
if ( zeBand[0]!=boundaries.getVariable("lastBand")
|| zeYear[0]!=boundaries.getVariable("lastYear") )
{
boundaries.set();
}
}
boundaries.setVariable("lastBand",zeBand[0]);
boundaries.setVariable("lastYear",zeYear[0]);
Note
We're using the exact same code we as used for CSV files, with the exception of parameters
expected by the createRegion() method. The API methods adapts to their context and therefore
expect different parameters to be passed in order to achieve the same thing. Since a text file does not
contain column names as a CSV does, the API expects the text regions to be defined using physical
coordinates. In this instance: (Left, Top, Right, Bottom).
You can try this code as well. Paste the data into the text editor of your choice and save the file
to Albums.txt. Then create a new DataMapper configuration and load this TXT as your data file.
In the Data Input Settings, specify On lines as the Page delimiter type with the number of lines
set to 1 so you can process the file line per line (i.e. triggering the event on each line). Then, set
the boundary Trigger to On script and paste the above code in the JavaScript expression and
click the Apply button to see the result.
Page 225